Mysterious TCP retransmission packets on semi-working TCP server client application

Thread Starter

Vilius_Zalenas

Joined Jul 24, 2022
192
Hi,

I am developing an application in which ESP32 acts as a TCP client (I use ethernet, not WiFi), and python script on the PC simulates the server (both codes are in the attachments). Both codes are quite long and complex, but main idea is the following: When ESP32 connects to the network, it sends a DHCP request and waits for the dynamic IP (considering it will only be used in such networks where DHCP server is present.) After obtaining IP, the ESP32 broadcasts specific keyword („scintilator“.) Meanwhile, the server is listening for exact keyword. As soon as the server catches this keyword, it sends back the exact same keyword message to the ESP32‘s IP. This is my DIY handshake mechanism to exchange the IP addresses. After the TCP connection is established, client waits for server to send it some specific parameters which are entered by the user in the python script. It may sound complicated, but everything works fine up until here...

As soon as I enter parameters for the server to send to the client, my program jams. ESP32 does obtain the correct parameters I have entered (I print those to the terminal), but the server side stops responding, and after a while spits me the 10060 error:

,, A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.“

I assume no hardware problems, because this program and the ethernet part works up until certain point is reached. I did my googling, research on forums, AI help etc., but seems like I am stuck on it. Wireshark sniffer kind of assures the python error (ESP32 stops sending any packets at the mentioned point.) Wireshark datagram shows that server constantly sends TCP retransmission packets (datagram is in the attachments. 192.168.1.23 is my PC, 192.168.1.50 is the ESP32)

I understand that you won't analyze all the 1000+ lines of code, neither I am asking for it, but is there something obvious that I am missing out? Maybe there are some not very complex approaches to start with? I have tested this code on other ESP32 boards (not exactly same boards, but ethernet hardware part was the same) and it worked without any problems. If I missed any of the details, please let me know, I will gladly specify those. Thank you in advance.
 

Attachments

Top