-->
Page 1 of 1

Can an ESP send and receive simultaneous UDP packet?

PostPosted: Mon Apr 09, 2018 12:52 pm
by mrlightsman
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.

Re: Can an ESP send and receive simultaneous UDP packet?

PostPosted: Tue Apr 10, 2018 3:31 am
by schufti
as WiFi is not duplex, devices tend to mute rx during sending, so --> mostlikely NO
(but that is not specific to esp8266)

but you can easily test it yourself and report your findings for the benefit of others ...

Re: Can an ESP send and receive simultaneous UDP packet?

PostPosted: Tue Apr 10, 2018 7:09 am
by rudy
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.

Re: Can an ESP send and receive simultaneous UDP packet?

PostPosted: Sat Apr 14, 2018 2:28 pm
by mrlightsman
As we speculated. It does not seem possible for an ESP to send and receive UDP at the same time.