Salut,
Eric Faden wrote:
> Dead link as in a no longer viable TCP socket. E.g. black holed etc. I
> want to detect it from the server end and kill the client, and detect it
> from the client end to start reconnection attempts.
with NIO, when a client close a connection, an NIO Selector wakes up and
the only way you can detect if the connection has been closed is by do
an operation on the connection, e.g. channel.read()/write(). So if you
want to detect a dead connection, you have to register for OP_READ
events and try to do a read. I know that sucks but that's the only way
for doing it using NIO. Are the connection created using the Grizzly
ConnectorHandler? If yes, make sure your CallbackHandler is looking for:
channel.read() == -1 or throw IOExceptoion (thanks win32 to act
differently).
Those 2 use cases happens when the remote server/client close the
connection.
Does that help?
Thanks
-- Jeanfrancois
>
> -Eric
>
> Jeanfrancois Arcand wrote:
>> Salut,
>>
>> Eric Faden wrote:
>>> Does anyone have an example of a pinger/heartbeater for dead link
>>> detection? I have been looking into writing one and am still unsure
>>> where to put it into the stack.
>>
>> By dead link, you mean a dead connection or a dead port on the server
>> side? Sorry if my question looks stupid :-)
>>
>> A+
>>
>> --Jeanfrancois
>>
>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>