tcp keep-alive
Posted: Wed Sep 05, 2018 9:09 am
Esp32 can't send keepalive messages as tcpserver?
code:
Int keepAlive = 1;
Int keepIdle = 20;
Int keepInterval = 3;
Int keepCount = 3;
Setsockopt (listenfd, SOL_SOCKET, SO_KEEPALIVE, (void*) &keepAlive, sizeof (keepAlive));
Setsockopt (listenfd, IPPROTO_TCP, TCP_KEEPIDLE, (void*) &keepIdle, sizeof (keepIdle));
Setsockopt (listenfd, IPPROTO_TCP, TCP_KEEPINTVL, (void*) &keepInterval, sizeof (keepInterval));
Setsockopt (listenfd, IPPROTO_TCP, TCP_KEEPCNT, (void*) &keepCount, sizeof (keepCount));
I set esp32 as TCP client to send keepalive messages success.
But setting esp32 as TCP server can't send keepalive messages.
Almost the same code, and setsockopt returns success, I wonder if anyone can help
code:
Int keepAlive = 1;
Int keepIdle = 20;
Int keepInterval = 3;
Int keepCount = 3;
Setsockopt (listenfd, SOL_SOCKET, SO_KEEPALIVE, (void*) &keepAlive, sizeof (keepAlive));
Setsockopt (listenfd, IPPROTO_TCP, TCP_KEEPIDLE, (void*) &keepIdle, sizeof (keepIdle));
Setsockopt (listenfd, IPPROTO_TCP, TCP_KEEPINTVL, (void*) &keepInterval, sizeof (keepInterval));
Setsockopt (listenfd, IPPROTO_TCP, TCP_KEEPCNT, (void*) &keepCount, sizeof (keepCount));
I set esp32 as TCP client to send keepalive messages success.
But setting esp32 as TCP server can't send keepalive messages.
Almost the same code, and setsockopt returns success, I wonder if anyone can help