- Thu Jul 09, 2015 9:13 pm
I have my ESP8266 accepting incoming TCP connections. I have a socket client running on a PC connecting to the ESP8266. It sends 100 bytes of data and then sleeps for a minute. Explicitly, it does NOT close the socket. On the ESP8266, the connection is seen to happen and we receive all the data as evidenced in the receive callback. However, exactly 10 seconds after the last receive, the ESP8266 disconnect callback is invoked and the connection is shutdown at the ESP8266 side. If I keep sending a few bytes every few seconds, then the ESP8266 connection stays active.
What I conclude from this is that the ESP8266 seems to automatically close a TCP connection if there has been no traffic over it for a period of 10 seconds or more. I haven't seen that documented as semantics. Has anyone any information of this apparent situation?
... Later ...
After some more study, I have located a function call called espconn_regist_time() which I think specifies an idle timeout on TCP connections. This may explain what I am seeing.
Free ESP8266 book available for download here