Discuss here different C compiler set ups, and compiling executables for the ESP8266

User avatar
By kolban
#22891 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.

Neil
User avatar
By kolban
#24229 Howdy,
I updated the 1st post of this thread. The TCP disconnect after 10 seconds is only the default. You can use the function called:

espconn_regist_time()

to change the disconnect interval. The maximum value is 7200 seconds (2 hours). See the SDK docs for details.

Neil