[LuaSocket]How to open socket?

Hey guys,

I`m trying to use LuaSocket, but stuck at moment when trying to sent a UDP message:

local send = socket.udp()

send:settimeout( 0 )

local txt1, txt2 = send:sendto( msg, “192.168.0.1”, 1234 )

print(txt1, txt2);

But sentto always returns a ‘refused’ error. How to solve that? What I`m doing wrong?

I`m trying it use example tutorial(in simulator), modified in forum, but stuck at this.

Here is project:

https://www.dropbox.com/s/7jjqua8dgf6qjs6/testSocket.zip?dl=0

What version of CoronaSDK are you using?  What platform are you on?

Is “192.168.0.1” a valid address on your local network?  You can run a command like this to check:

ping 192.168.0.1

192.168.0.1 is normally the address of your router and I doubt it will respond to UDP packets

Yes, that is my router. It is responding to ping from local network.

I get same result for running:

send:setoption( “broadcast”, true )  --turn on broadcast

local txt3, txt4 = send:sendto( msg, “255.255.255.255”, 1234 )

also - refused to sent.

What version of CoronaSDK are you using?  What platform are you on?

Is “192.168.0.1” a valid address on your local network?  You can run a command like this to check:

ping 192.168.0.1

192.168.0.1 is normally the address of your router and I doubt it will respond to UDP packets

Yes, that is my router. It is responding to ping from local network.

I get same result for running:

send:setoption( “broadcast”, true )  --turn on broadcast

local txt3, txt4 = send:sendto( msg, “255.255.255.255”, 1234 )

also - refused to sent.