Laurent Cohen a écrit :
Hello all,

Typically, a technique that I've implemented was using the fact that, when the remote peer is disconnected for any reason, the corresponding SelectionKey on the server becomes readable().
Even when the client hasn't sent a FIN ?
It is possible to use this when you know for example that the connection should be either idle or waiting for the server to send something. In this case, you just need to add OP_READ to the operations the key is interested in. For instance, if an idle connection becomes suddenly readable - as in SelectionKey.isReadable() - then it means it is disconnected.
Well, I would rather bet that this means something has to be read.
For this to apply, you also need to keep some state attached to the SelectionKey, so that you know that it is readable when it shouldn't.
I'm not sure I grok what you says her, but may be I need a coffee or two... (just woke up).

--
Regards,
Cordialement,
Emmanuel Lécharny
www.nextury.com


Reply via email to