I have a question with reference to this tutorial
http://rox-xmlrpc.sourceforge.net/niotut/
In the read method of the server, if read returns -1 then does it always mean client has closed connection??
I modified the example client to sleep for long time after sending the message I see that the selector.select() does not block and keeps selecting the channel as readable even if client is not sending anything and server reads method reads and returns -1, and thus closes the channel, but the client has not disconnected.
I do not understand this behavior. Can some one help me understand?
I am trying to modify the server so that the server does not disconnect with client even if client is not sending anything and so it must block at selector.select().
thank you!
Yes. Always.
Yes it has. That’s what it means. The client has closed the connection.