I have a C++ application on an IOT device that connects to a server over a TCP socket. The IOT device can be put into airplane mode, lose signal, etc. When this happens, my socket (as reported by netstat) still shows as ESTABLISHED. When my application writes to this socket via send(), everything from the application’s perspective is fine (no error codes). However, I see the send-Q growing in netstat.
When the device comes out of airplane mode or gets a good signal again, the data is never transmitted to the server despite the “ESTABLISHED” connection. Is there any way that I can get this data to send, or will I have to reestablish the socket again? How can I detect that the connection has been broken?
I’ve tried using SO_KEEPALIVE, TCP_KEEPCNT, TCP_KEEPIDLE, and TCP_KEEPINTVL on the socket, but this hasn’t seemed to help.