Server not getting TCP disconnection on ESP power failure
Posted: Sun Jun 07, 2020 9:04 am
Dear all,
Use case:
I'm having a TCP server application running in Ubuntu. This server manages all the connected clients and their states(Online/Offline).
When a client connects, server makes its state to "Online". When a disconnection is detected, the server updates its state to "Offline".
Issue:
I use the esp8266 in station mode and make TCP connection to the server using the WifiClient class. The problem here is, on power failures(unplugging of usb) of esp8266, the server is not receiving the disconnection, unless WifiClient.stop() is explicitly called. Thus the server shows up a false online status for esp8266 client.
For implementing a graceful shutdown, I've been thinking of ways to create a cheap and compact backup power source at the esp8266 side, like a capacitor, which provide some backup power to execute some cleanup routine on power failures. Will this be enough to get enough cycles to execute WifiClient.stop()? Has anybody came across such a use case before?
All suggestions & help would be appreciated.
Thank you!
Use case:
I'm having a TCP server application running in Ubuntu. This server manages all the connected clients and their states(Online/Offline).
When a client connects, server makes its state to "Online". When a disconnection is detected, the server updates its state to "Offline".
Issue:
I use the esp8266 in station mode and make TCP connection to the server using the WifiClient class. The problem here is, on power failures(unplugging of usb) of esp8266, the server is not receiving the disconnection, unless WifiClient.stop() is explicitly called. Thus the server shows up a false online status for esp8266 client.
For implementing a graceful shutdown, I've been thinking of ways to create a cheap and compact backup power source at the esp8266 side, like a capacitor, which provide some backup power to execute some cleanup routine on power failures. Will this be enough to get enough cycles to execute WifiClient.stop()? Has anybody came across such a use case before?
All suggestions & help would be appreciated.
Thank you!