Difference between Ethernet and Wifi for receiving UDP packet just after sending
Posted: Tue Apr 23, 2019 5:36 am
Hello,
What am I doing wrong?
I am using a tweaked version of the UDP client and UDP sever code.
https://github.com/espressif/esp-idf/tr ... udp_client
https://github.com/espressif/esp-idf/tr ... udp_server
I have the udp_server code running as a Task (as in the example) receiving everything hitting port 17288. It then prints the message received.
I have the udp_client code running as a single function triggered from a timer every 8 seconds. The client code performs the sendto() but it does not try to receive anything, it closes the socket after the send.
I have another piece of hardware that is broadcasting a message [1] as well as listening for the ESP32. When it receives the message [2] from the ESP it responds with a new message [3]. (Numbering the messages for future)
The Problem:
When I configure the ESP32 to only use a Wifi connection to my network, the response[3] is seen by the ESP32.
When I configure the ESP32 to only use an Ethernet connection to my network, the response[3] is NOT seen by the ESP32.
I have used a hub and wireshark to confirm the messages are traveling the network. The only difference between the messages in Wireshark is the IP address is different for the Wifi/Ethernet connections.
I have also confirmed that the ESP32 is correctly receiving the response[3] if it is sent from a different source (virtual box netcat) however this is just sent at a random time, not immediately after the ESP32 sends it.
I also tested just using the UDP client (no server) with the receive code in... waiting for 1 second before moving past the recvfrom(sock...) code. Again this did not work for Ethernet, but it did for Wifi.
If you need me to post the code I am using, I can.
Shaun
What am I doing wrong?
I am using a tweaked version of the UDP client and UDP sever code.
https://github.com/espressif/esp-idf/tr ... udp_client
https://github.com/espressif/esp-idf/tr ... udp_server
I have the udp_server code running as a Task (as in the example) receiving everything hitting port 17288. It then prints the message received.
I have the udp_client code running as a single function triggered from a timer every 8 seconds. The client code performs the sendto() but it does not try to receive anything, it closes the socket after the send.
I have another piece of hardware that is broadcasting a message [1] as well as listening for the ESP32. When it receives the message [2] from the ESP it responds with a new message [3]. (Numbering the messages for future)
The Problem:
When I configure the ESP32 to only use a Wifi connection to my network, the response[3] is seen by the ESP32.
When I configure the ESP32 to only use an Ethernet connection to my network, the response[3] is NOT seen by the ESP32.
I have used a hub and wireshark to confirm the messages are traveling the network. The only difference between the messages in Wireshark is the IP address is different for the Wifi/Ethernet connections.
I have also confirmed that the ESP32 is correctly receiving the response[3] if it is sent from a different source (virtual box netcat) however this is just sent at a random time, not immediately after the ESP32 sends it.
I also tested just using the UDP client (no server) with the receive code in... waiting for 1 second before moving past the recvfrom(sock...) code. Again this did not work for Ethernet, but it did for Wifi.
If you need me to post the code I am using, I can.
Shaun