jeelabs / esp-link

esp8266 wifi-serial bridge, outbound TCP, and arduino/AVR/LPC/NXP programmer
Other
2.82k stars 720 forks source link

Option to disable auto close of socket if no activity is detected. #365

Open drencorxeen opened 6 years ago

drencorxeen commented 6 years ago

Is there any way to add a option to the firmware to disable the auto close of the TCP connection?

I have a project where the ESP-Link keeps closing the connection. The Server I am running is setup to directly connect to the ESP-Link device and then wait for the device that the ESP-Link is connected to send transparent data requests to the server, but some times the device the ESP-Link is wired to doesn't send data for minutes or hours at a time. The server is setup to do TCP keepalives, but the ESP-Link still seems to close the connection if no active data is being transfered over the connection.

Is there a way to change this or alter the behavior of ESP-Link?

Eloquence4 commented 6 years ago

If you are talking about a connection dropping exactly 10 seconds after not being used, then that's a default behaviour in the esp8266 non-os SDK. To change that look at "4.2.2. espconn_regist_time" here: https://www.espressif.com/sites/default/files/documentation/2c-esp8266_non_os_sdk_api_reference_en.pdf

EDIT: 10 seconds after being not used, not after being created