r/esp8266•
unfoundbug

Help request: Stuck socket

I'm using an ESP-201 (also happens on the 01) and it gets into a weird state after a short time of network activity.

For my use case I am sending about 500 bytes every 5ms (this has a 1 byte response). This works for between 5 seconds and 15 minutes and then it goes into a really bizzare state. The remote app sending the data times out due to lost connection, but the ESP still sees the socket as open, as the ESP is in single client mode, I am then forced to restart the ESP if I actually want it to do anything.

At this point I have already commented out the code that processes the data coming in, so all the ESP is effectively doing is assembling the packets, and responding with an OK byte

Edit: To make it clearer I am using the SDK, not the arduino port

Posted Jul 21, 2015, 10:39 AM UTC · edited

35
BrewerGlyph•

Are you using the latest firmware?

1
unfoundbugOP•

Yeah, updated to the latest SDK to try and see if that helped. It didnt.

1
tigeba•

Do you have the watchdog enabled? Just wondering if it is crashing or otherwise seizing up. Have you tried yield()'ing and feeding the watchdog timer ( ESP.wdtFeed(); ) in your main loop?

1
unfoundbugOP•

Watchdog timer is off, as I am using the SDK, I don't actually HAVE a main loop

1
tigeba•

I may not be able to help there as I have not been programming directly with the SDK. With the Arduino version it has been my experience you need to let the watchdog know everything is ok occasionally, as well as yielding in the main loop. I was wondering if you might be actually crashing, and with the WDT off it is just going into a bizarre state?

1