GX400 3G UDP server


#1

Hi all,

Is there a special setting that must be enabled to allow reception and sending of UDP packets on the 3G adapter? Uinsg udp:setsockname, I’ve tried binding to both 0.0.0.0 and the 3G adapter address on port 8082. While the server receives packets from the LAN, it doesn’t receive anything from the 3G network. I’ve also verified that the network isn’t blocking this port by forwarding pakets to this port to a device on the LAN adapter. Appreciate if someone could shed some light on this.

Best Regards

William


#2

Here’s more info regarding the problem:

i) It appears that there was a bug in the bind operation - the host parameter should have been “*” instead of INADDR_ANY to bind to all adapters
however
ii) while sending works over the 3G adapter, I am still having no luck with the receivefrom opeartion (LAN is ok)

Any info/suggestions will be appreciated


#3

Hi,

at AAF/Lua’s level, there’s nothing interface-specific, so the problem is most likely at some lower level. Are you sure that your telecom operator lets UDP come through? Most of them run through a NAT, and some of them don’t enable every protocol by default.


#4

Hi fft,

Yes, we’ve rechecked (several times) that the telco isn’t blocking the traffic by configuring the GX400 to port forward the packets to another device on the LAN port and observed packets flowing through every time. The sample code below reproduces the problem.

cheers

William


local socket = require(“socket”)
local sched = require (“sched”)

local ghost = “*”
local gport = 16001

local function main ()
udp = socket.udp()
udp:setsockname(ghost, gport)
udp:settimeout(0)

local dgram, lip, lport

while (true) do
	dgram, lip, lport = udp:receivefrom()
	
	if dgram then
		print("received datagram from", lip, lport)
		
	else
		socket.select(nil, nil,0.05)
	end
	
	sched.gc()

end

os.exit()

end

sched.run(main)
sched.loop()