Path: utzoo!attcan!uunet!lll-winken!ames!amdahl!rtech!wrs!hwajin
From: hwajin@wrs.wrs.com (Hwajin Bae)
Newsgroups: comp.protocols.tcp-ip
Subject: Re: connect(2) timeout
Message-ID: <747@wrs.wrs.com>
Date: 17 Aug 89 18:31:08 GMT
References: <24692@iuvax.cs.indiana.edu>
Reply-To: hwajin@wrs.wrs.com (Hwajin Bae)
Organization: Wind River Systems, Emeryville, CA
Lines: 32

In article <24692@iuvax.cs.indiana.edu> hughes@silver.bacs.indiana.edu (larry hughes) writes:
>Does anyone know how to modify the default time that it
>takes for a connect(2) to time out?  I've tried
>setsockopt(2) without success (I think that's for
>reads and writes, not connect).  The default time of
>1:15 is too long for my application.

When connect() is requested, TCP protocol implementation in BSD 4.3-Tahoe 
will send a SYN packet and start a keep-alive timer.  Initially, when the
remote machine you're trying to connection to doesn't respond within
75 seconds (TCPTV_KEEP_INIT) with an ACK/SYN (initial phase of the TCP 
three-way handshake connection set-up protocol), the keep-alive timer will 
start sending a keep-alive packet ()
every 75 seconds (TCPTV_KEEPINTVL) until it receives a packet from the
other side or upto 8 times (TCPTV_KEEPCNT).   So, 8 * 75 => 600 == 10 minutes
in 4.3 BSD.  The constants in parentheses are defined in netinet/tcp_timer.h.
You can change the global variables "tcp_keepintvl" to change the
kernel's idea of TCPTV_KEEPINTVL using adb on BSD Unix.  As in,

% adb -k -w /vmunix /dev/mem
  tcp_keepintvl?W 60

Note also that these numbers tend to vary in different implementations as
well as in various releases of BSD Unix code itself.  Pre-4.3-tahoe releases
of the networking code only had TCPTV_KEEP (45 sec) and 
TCPTV_MAXIDLE (8 * 45 sec).

-- 
Hwajin Bae
Wind River Systems
1350 Ocean Ave
Emeryville, CA 94608