Postby pratik » Thu Jul 21, 2016 12:19 pm
If you have many devices listening to the same post, you can send a packet to the UDP broadcast address (instead of a particular device), which will be broadcast to all the other devices that are listening.
The broadcast address is the last host address within the range defined by the subnet mask.
- AT+CIPSTART=4,"UDP","192.168.1.255",1300,1300,2 - command to module: open connection 4, UDP, broadcast address, port 1300, time-out 2 sec
OK - module replies
- AT+CIPSEND=4,16 - command to module: connection 4, 16 bytes to send
> - module is ready to read data
- send 16 bytes of data
- Recv 16 bytes
SEND OK - module replies
- AT+CIPCLOSE=4 - command to module: close connection 4
OK - module replies
Thanks for your information. It basically works.
A minor feedback of this "AT+CIPSTART=4,"UDP","192.168.1.255",1300,1300,2 - command to module: open connection 4, UDP, broadcast address, port 1300, time-out 2 sec", 2 is not time-out for UDP, but it is for TCP. For UPD transmission, it is UDP mode.
One more question, for UDP broadcasting, how should we know where is the message received from? To implement recvfrom function, we need to know the client's IP address and port number. Can you suggest which API in the SDK can be used? Thanks.
I need to receive broadcast UDP datagrams with AT commands but it does not work.
Using the following command
the 8266 only receive datagrams directed to its own IP and does not receive broadcasts.
Someone can help?
(The examples above only work when the netask is 0xFFFFFF00.)
I do not see any way to get the netmask with the AT commands. Is there a way?
Who is online
Users browsing this forum: No registered users and 2 guests
Newbies Start Here
Are you new to ESP8266?
Unsure what to do?
Dunno where to start?
Start right here!
We also have a RTOS version and a MESH version too!
Complete listing of the official ESP8266 related documentation release by ESPRESSIF!
Must read here!