From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,30f7dbc137470c88 X-Google-Attributes: gidfee84,public From: mogul@actitis.pa.dec.com (Jeffrey Mogul) Subject: Re: keep-alive on tcp/ip-socket connections Date: 1996/10/23 Message-ID: <54jq2b$cgt@usenet.pa.dec.com>#1/1 X-Deja-AN: 191357257 references: <54fqd5$m4e@news.uni-c.dk> <54g21p$fum@rit.cs.rit.edu> organization: DEC Western Research newsgroups: comp.unix.osf.osf1 In article <54g21p$fum@rit.cs.rit.edu>, dpc6787@illinois.cs.rit.edu (David P Cutter) writes: |> In article <54fqd5$m4e@news.uni-c.dk>, Ole Joergensen wrote: |> >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). |> > |> [...stuff deleted...] |> > |> Yes! I've been complaining about this one for a while. We have to solve |> the same type of problems as described above. |> |> Most TCP/IP vendors do not allow a programmer to specify a timer value |> for keep-alives. And on top of that, there is no way to specify a |> different timer per/socket - it's global value based per net interface. |> For that reason most vendors implement these values in the kernel. On |> Solaris we can use the ndd utility to change these values, on DUnix |> edit /sys/conf/ and add/change the tcp_keepidle, tcp_keepintvl |> values [...opps, I never did try this on DUnix...]. If the kernel |> config doesn't work, you may have to "adb" the kernel and change the |> values by hand (yuk). Actually, in Digital UNIX V4.0, you can indeed set the TCP keepalive parameters per-socket. See "man 7 tcp", wherein it is written: TCP_KEEPIDLE When the SO_KEEPALIVE option is enabled, TCP probes a connection that has been idle for some amount of time. The default value for this idle period is 2 hours. The TCP_KEEPIDLE option can be used to affect this value for a given socket, and specifies the number of seconds of idle time between keepalive probes. This option takes an int value, with a range of 1 to N (where N is tcp_keepidle divided by PR_SLOWHZ). For more information on tcp_keepidle see the information on the inet sub- system configuration attributes in the System Tuning and Performance Management guide. PR_SLOWHZ is defined in the header file. Similarly for TCP_KEEPINTVL and TCP_KEEPCNT, and a few other knobs to twiddle. -Jeff