Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Wifi module ESP8266 to send UDP broadcast message

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?

like image 687
user2170949 Avatar asked Nov 19 '25 22:11

user2170949


1 Answers

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.

like image 152
some user Avatar answered Nov 22 '25 12:11

some user