UDP broadcast packets not always sent
Posted: Sun Nov 22, 2015 8:44 am
Seems to be a strange problem with UDP working as broadcast:
- UDP packet sent on a specific IP are always sent. Works fine.
- same UDP packet sent on broadcast IP (xx.xx.xx.255) are sent randomly...
Checked with WireShark
Any idea ? I am really confused, because I made 4 UDP receiver boards and I am not able to make the sender one working !!! I think to use a workaround by coding directly in C on ESP07, but my fear is that the bug reside in Espressif API and so not working better...
- UDP packet sent on a specific IP are always sent. Works fine.
- same UDP packet sent on broadcast IP (xx.xx.xx.255) are sent randomly...
Checked with WireShark
Code: Select all
function update()
local payload
if(UDP_test_toggle == 1) then
UDP_test_toggle = 0
payload = "Number 1"
else
UDP_test_toggle = 1
payload = "Number 0"
end
print(payload)
local broadcast_IP = wifi.ap.getbroadcast()
cu=net.createConnection(net.UDP)
cu:connect(5683, broadcast_IP)
cu:send(payload)
cu:close()
end
wifi.setmode(wifi.SOFTAP)
cfg={}
cfg.ssid="XXXXXXXX"
cfg.pwd="88888888"
cfg.hidden=1
wifi.ap.config(cfg)
tmr.alarm(0, 1000, 1, update)
Any idea ? I am really confused, because I made 4 UDP receiver boards and I am not able to make the sender one working !!! I think to use a workaround by coding directly in C on ESP07, but my fear is that the bug reside in Espressif API and so not working better...