I'm using Java NIO in to accept, read and write in my server.
In the documentation it said that the SocketChannel.read()
function will return the number of bytes read from socket, and -1 if it reach end of stream.
Now - i don't really understand what does "End Of Stream"
mean? is it as same as borken pipe
error ?
Does it mean that the connection is lost for both side and i should close the SocketChannel ?
I would be really great full if someone can explain more about it - and give some example of using and behaving correctly according to it..