db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Hlavatý <hla...@code.cz>
Subject Re: Help detecting client disconnects for network server
Date Sat, 09 Oct 2004 11:51:27 GMT
Did you try setting SO_KEEPALIVE socket option using Socket.setKeepAlive(boolean)?
That what its for. The timeout may be really long though (sbout 2 hours),
but may be tuned on OS level (globally).

On linux, you can use sysctl (/etc/sysctl.conf):

net/ipv4/tcp_keepalive_time = <number of seconds to send probe>
net/ipv4/tcp_keepalive_probes = <number of failed probes to kill connection>

Or use /proc to configure directly:

For Win XP:

For Win NT/2K, see KeepAliveTime and KeepAliveInterval here:

For Win 95/98/Me:

Also note, unplugging a network cable does not mean the TCP connection is disconnected.
TCP does not track the state of the transport media in any way.
You can unplug the cable, plug it back and happily continue.

View raw message