Post by Michael Zayat » Sat, 10 Nov 2001 00:45:45

I am trying to use the following code to enable keepalives on tcp connection

  int optval;

  optval = 1; // enable
  setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &optval, sizeof(optval);

  optval = 60; // every 60 seconds
  setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, &optval, sizeof(optval);

  optval = 10;//10 sec between  intervals
  setsockopt(fd, IPPROTO_TCP, TCP_KEEPINTVL, &optval, sizeof(optval);

  optval = 5;//5 timeouts before death
  setsockopt(fd, IPPROTO_TCP, TCP_KEEPCNT, &optval, sizeof(optval);

it should drop the connection after 60 + (5*10) = 110 seconds of inactivity

i plug on of my boxes out and the box that have just run this code doesn't
feel it, even after 10 minutes

any clue?



1. tcp_keepidle is not functioning. any clues???


I'm facing a problem where it seems that tcp_keepidle
is not working. In a client/server (MsWindows/Aix 4.1.4)
when the network connection is broken, tcp/ip should
aknowledge the fact that the session has died after tcp_keepidle
(keepalive) expires. But it is not working.

By default, tcp_keepidle is set to 2 hours. I've decreased it
to 2,5 minutes (tcp_keepidle=300). (You can change that by using
(no -o) utility.

Any ideas/clues about that? Am I missing something?

Greetings from Miami,


2. modem + PPP

3. tcp_keepidle

4. RPC programming problems

5. CDE vs. /etc/passwd, /etc/shadow and /etc/group

6. Did any Unix System have patched SYN-Flood?

7. ssh chrooted enviroment WITHOUT /bin /etc /lib - etc etc in the users dir ?

8. FreeBSD and BSD basis

9. 3.5 MO, zip, etc, etc, etc.

10. ps/1, Lilo, etc etc etc problems w/ instalation

11. Looking for sample /etc/named.conf and etc/resolv.conf and /etc/hosts

12. LINUX, 3COM ImpactIQ, ISDN, etc, etc, etc...

13. Comment out a line in /etc/passwd & /etc/shadow