1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-16 11:21:18 +03:00

keepalive api (default 2h,75s,9 not enabled) (#3937)

This commit is contained in:
david gauchard
2018-01-05 04:17:37 +01:00
committed by Develo
parent fb7c519856
commit 9cfbbc7ad3
3 changed files with 72 additions and 0 deletions

View File

@ -30,6 +30,10 @@
#define WIFICLIENT_MAX_PACKET_SIZE 1460
#define TCP_DEFAULT_KEEPALIVE_IDLE_SEC 7200 // 2 hours
#define TCP_DEFAULT_KEEPALIVE_INTERVAL_SEC 75 // 75 sec
#define TCP_DEFAULT_KEEPALIVE_COUNT 9 // fault after 9 failures
class ClientContext;
class WiFiServer;
@ -85,6 +89,13 @@ public:
static void stopAll();
static void stopAllExcept(WiFiClient * c);
void keepAlive (uint16_t idle_sec = TCP_DEFAULT_KEEPALIVE_IDLE_SEC, uint16_t intv_sec = TCP_DEFAULT_KEEPALIVE_INTERVAL_SEC, uint8_t count = TCP_DEFAULT_KEEPALIVE_COUNT);
bool isKeepAliveEnabled () const;
uint16_t getKeepAliveIdle () const;
uint16_t getKeepAliveInterval () const;
uint8_t getKeepAliveCount () const;
void disableKeepAlive () { keepAlive(0, 0, 0); }
protected:
static int8_t _s_connected(void* arg, void* tpcb, int8_t err);