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 Sun, 10 Oct 2004 11:33:28 GMT
Samuel Andrew McIntyre wrote:
> 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?

This is simply not true. SO_KEEPALIVE works, even for blocking in reads.
I have tested it.


View raw message