Tue Jun 22 03:48:46 CEST 2004
Per Hedeland wrote:
> Matthias Lang <matthias@REDACTED> wrote:
>>It appears that you can't configure the keepalive time on a per-socket
>>basis, at least not under linux 2.4.25.
> Actually you can - from live and working code on 2.4.20-ish:
> int one = 1, idle = 60, intvl = 5, cnt = 3;
> setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &one, sizeof(one));
> setsockopt(fd, SOL_TCP, TCP_KEEPIDLE, &idle, sizeof(idle));
> setsockopt(fd, SOL_TCP, TCP_KEEPINTVL, &intvl, sizeof(intvl));
> setsockopt(fd, SOL_TCP, TCP_KEEPCNT, &cnt, sizeof(cnt));
> (Those particular values are *not* suitable for your generic TCP session
> though.) I think I found documentation of this on some random web page
> (typical for Linux:-), it certainly isn't in the man pages.
Yes it is: man 7 tcp
> But you have the source...:-)
>>Maybe it's possible under
>>other operating systems, probably not. I don't know enough about other
>>OSs' TCP stacks to answer.
> I'll add my two öre to the "probably not" vote.
TCP_KEEPIDLE et al are not Linux-specific; AFAICS they seem to be supported
on all BSD-derived TCP stacks (most Unices including OS X, also OpenVMS, but
On Win32 there is an IOCTL that sets the equivalent of TCP_KEEPIDLE and
TCP_KEEPINTVLs on a per-socket basis: search for WSAIoctl or
David Hopwood <david.nospam.hopwood@REDACTED>
More information about the erlang-questions