Hi,
I am writing a proxy in Android. I want to know, how one may detect if the server or client has closed its socket? I am using pre-NIO sockets. It should be noted that, the YouTube App will connect with my Proxy server (I have installed proxydroid) and then data will pass between YouTube App and Youtube Server through my proxy.
I have used read() method for reading. When I am reading (with read() ) as a client (from the server) if I get -1, does it mean that the server has closed
the socket?
In the same way, If I am reading (with read()) from the client and get -1, does it mean that the client has closed the socket?
What is the best way to detect if a remote peer has closed the socket or not?
If I use methods like isInputShutdown() or isOutputShutdown(), will that help?
My main goal is read into a byte array until the remote peer has closed the socket? Any sample code will be much appreciated.
Bye.
I am writing a proxy in Android. I want to know, how one may detect if the server or client has closed its socket? I am using pre-NIO sockets. It should be noted that, the YouTube App will connect with my Proxy server (I have installed proxydroid) and then data will pass between YouTube App and Youtube Server through my proxy.
I have used read() method for reading. When I am reading (with read() ) as a client (from the server) if I get -1, does it mean that the server has closed
the socket?
In the same way, If I am reading (with read()) from the client and get -1, does it mean that the client has closed the socket?
What is the best way to detect if a remote peer has closed the socket or not?
If I use methods like isInputShutdown() or isOutputShutdown(), will that help?
My main goal is read into a byte array until the remote peer has closed the socket? Any sample code will be much appreciated.
Bye.