We have a java server that keeps a socket channel open with an Android client in order to provide push capabilities to our client application.
However, after putting the Android in airplane mode, which I expected would sever the connection, the server can still write to the SocketChannel object associated with that Android client and no error is thrown. Calling SocketChannel.isConnected() before writing to it returns true.
What are we missing? Is the handling of sockets different with mobile devices?
Thanks in advance for your help.
SocketChannel.socket().isConnected() and SocketChannel.isConnected()
return false before the socket is connected.
Once the socket is connected they will return true,
they will not revert to false for any reason.
SocketChannel.isOpen() returns true
until you call SocketChannel.socket().close() or SocketChannel.close().
Once you have called close() on the socket, SocketChannel.isOpen() will
return false,
no other event will cause it to return false.
SocketChannel.socket().isClosed() returns false
until you call SocketChannel.socket().close() or SocketChannel.close().
Once you have called close() on a socket -
SocketChannel.socket().isClosed() will return true,
no other event will cause it to return true.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With