So you're a Noob? Post your questions here until you graduate! Don't be shy.
User avatar
By mrlightsman
#75237 I have an application specific question which may not make much sense in the "real world". Can an ESP8266-01 send a UDP packet to itself? Or, in other words, can it simultaneously send and receive UDP packets reliably?

I have several switches which are all mapped using UDP packets. Some ESPs act as pushbutton switches and others act as receivers controlling relays.

In circumstances where a relay and a switch need to be in the same location, I could (and have been) easily control the relay with a simple if... digitalWrite.... type statement in a traditional way (ignoring any UDP communication). However, to hold true to my mapping scheme, I would like to have the ESP send a UDP packet (as it would for any "remote" device), but rather than sending it to a second ESP-01, I want it to essentially send it to itself.

This would mean the pushbutton (send a packet) is blind to the fact that the relay (receive a packet) is on the same board, or across the WLAN. Everything gets treated the same way.

UDP is working fine for me. I understand how to send and receive packets. I just wonder if an ESP can send a packet to itself. It would look like it is sending a packet to its own IP address.

Is this within the ESP-01 ability? UDP protocol? And, will it be reliable?

Thanks for the input. I realize how impracticle this approach must seem.
User avatar
By rudy
#75258 I think I read (long ago) that it would get the packet. But it was an internal thing and done before the radio. So while I agree that the radio prevents itself from hearing the actual transmission it still would be worth trying to see if it would work.