lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hello,

I'm new to Lua ... so I hope my question isn't too basic. I'm trying to send a udp packet via broadcast. I have put together some test code:

require 'socket'

host = "localhost"
port = 47808

udp, err = socket.udp()
if not udp then print(err) os.exit() end

udp:setoption('broadcast', true)

err = udp:setsockname(host, port)
if err == nil then print(err) os.exit() end

udp:setpeername('10.0.1.255', 47808)

result, err = udp:send('this is a test')
--result, err = udp:sendto('this is a test', '10.0.1.255', 47808)
if result == nil then print(err) os.exit() end

udp:close()

It appears to finish without any problems, but when I watch on wireshark the udp packet never appears anywhere. Am I doing something wrong in Lua? Am I perhaps doing something wrong with wireshark (even though I'm getting OTHER broadcast messages)? Any idea?

Thanks,
Snowdall

Attachment: smime.p7s
Description: S/MIME cryptographic signature