Re: Per-connection TCP_KEEPALIVE setting?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Sep 20, 2003 at 10:51:34PM +0300, Nick Patavalis wrote:
> > But I'm looking for an integer option that determines how often
> > keepalives are sent...
> 
> I don't think you can do this on a per-connection basis. If it is a
> custom application protocol, you can of-course add your own keepalive
> messages. I was dealing with the same issue a couple of years ago, and
> ended-up doing exactly this.

The application is a MUSH/MUD, which uses TCP/IP and has no way of
sending a no-op so TCP/IP keepalive seems to be the only choice.

I found the option; it involves the TCP_KEEPIDLE socket option. Here
is the full solution in case it's useful to anyone:

int keepalive = 1;
int keepidle = 900;

/* sock is the socket */
setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, (void *) &keepalive, sizeof(keepalive));
setsockopt(sock, SOL_TCP, TCP_KEEPIDLE, (void *) &keepidle, sizeof(keepidle));
-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux