Using Wifi module ESP8266 to send UDP broadcast message

user2170949 picture user2170949 · Jun 3, 2015 · Viewed 9.2k times · Source

I need to communicate Arduino module with my Phone through ESP8266 wifi module

They all link to the local LAN network and didn't know the IP address of each other, so I plan to send UDP broadcast message from my phone, but ESP8266 module seems doesn't receive the message

The ESP8266 library I use is from here: https://github.com/itead/ITEADLIB_Arduino_WeeESP8266

and use the function registerUDP() and recv()

Can somebody help me?

Answer

some user picture some user · Jun 4, 2015

I don't have enough reputation to leave a comment so I will make an answer.

I have a feeling that your registerUDP() need to specify an IP address and I guess you are supplying your DHCP assigned IP address. Where as the UDP broadcast is sent using a multicast or broadcast IP.

You can modify the initiator code to send UDP packet to all IP within the same subnet (e.g. 192.168.1.1 to 192.168.1.254) and see if it works.