tcp keep-alive

1163167506
Posts: 30
Joined: Mon Jun 11, 2018 5:52 am

tcp keep-alive

Postby 1163167506 » 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

Who is online

Users browsing this forum: No registered users and 95 guests