-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On Oct 9, 2004, at 4:51 AM, Jan Hlavat� wrote:

Did you try setting SO_KEEPALIVE socket option using Socket.setKeepAlive(boolean)?
That what its for.

The way I read it, setting SO_KEEPALIVE just sets the option of the same name in the underlying native implementation. While the underlying TCP implementation on the server would keep track of the whether or not the client machine responded to probes by the server, the application would not actually be notified until a write was attempted on the socket after the keepalive timeout (or the timeout expired while we're blocked on a write), at which time the native implementation would return SIGPIPE and presumably a SocketException would be thrown.


In the case where we're blocked on a read, the application would never be notified. In the case that you need to be able to timeout on a read, you would need to use SO_TIMEOUT or implement your own timer. Or am I misunderstanding how keepalive works?

andrew
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)

iD8DBQFBaI5ODfB0XauCH7wRAkwfAJ4gjCfXpXvagAPQ3U+dR5l7LNEzOACcCMqf
rioNA8IgFNbBRQHrMspMFOE=
=OgHV
-----END PGP SIGNATURE-----



Reply via email to