Since updating my Corona Enterprise to 2016.2886 from 2015.2625, network communication using the socket library has been failing. I have also tried with 2016.2904 and 2016.2906.
What we do is multicast over a port range that our servers could be listening for over a local network. We do not get any errors outputting automatically about this, it just fails to communicate with anything. Our server does not receive any messages while the app is broadcasting.
The only sort of error we get back is the remoteIP returned by udpsock:receivefrom(…) is “ai_family is not supported.”
Here is a snippet showing a boiled-down version of how we use it:
local Socket = require("socket") local udpsock = Socket.udp() udpsock:setoption("broadcast", true) udpsock:setoption("ip-multicast-loop", true) udpsock:setoption("ip-multicast-ttl", 100) udpsock:settimeout(0) local data = nil local remoteIP local port local ip = "192.168.0.1" -- we have a specific IPv4 address that our servers subscribe to for multicast local startTime = os.clock() -- scan all dynamic ports for available services on our network for portNum=65000,65535, 1 do udpsock:sendto("test me "..ip, ip, portNum) end data,remoteIP,port = udpsock:receivefrom(512) -- result: data = nil, remoteIP = "ai\_family is not supported", port = nil local elapsedTime = 0 while(elapsedTime \< 5) do if(data and data == whatWeExpectFromOurServer) then -- this is the server we will use break end data,remoteIP,port = udpsock:receivefrom(512) -- result: data = nil, remoteIP = "ai\_family is not supported", port = nil elapsedTime = os.clock() - startTime end udpsock:close() -- set the ip of the server we will use and attempt to establish a session
Thoughts on what might be going on would be greatly appreciated.