From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,30f7dbc137470c88,start X-Google-Attributes: gidfee84,public From: oj@dk-online.dk (Ole Joergensen) Subject: keep-alive on tcp/ip-socket connections Date: 1996/10/21 Message-ID: <54fqd5$m4e@news.uni-c.dk>#1/1 X-Deja-AN: 190945321 organization: Your Organization content-type: Text/Plain; charset=US-ASCII mime-version: 1.0 newsgroups: comp.unix.osf.osf1 Does anybody know how to control sending of 'keep-alives' on tcp-connections (OSF/1 - alpha platforms) ? The problem arises when programming tcp at the socket-level (in C). Consider, as an example, a proces running under OSF (on an alphabox) which communicates with a proces running on (say) a PC via a connected pair of tcp/ip-sockets. If the pc is turned of (or explodes or whatever) the socket-software on the PC won't have time to tell that it's going down and the socket-software on the alphabox will not recieve any notification that the connection is broken. To deal with this one needs to set up the tcp-connection so that it is periodically probed by sending 'keep-alives'. This is indeed possible in C, under OSF. In the file /usr/include/netinet/tcp_timers.h two constants are defined: #define TCPTV_KEEP_IDLE (120*60*PR_SLOWHZ) /* dflt time before probing */ #define TCPTV_KEEPINTVL ( 75*PR_SLOWHZ) /* default probe interval */ and this, as far as I understand, means that the first keep-alive will be sendt 2 hours after establishing the connection, and then keep-alives will be sendt every 75 seconds. The question is then: How does one change this? How can you make the probing start as soon as the connection is established?