socket.isConnected()
returns always true once the client connects (and even after the disconnect) weird !!socket.getInputStream().read()
returns -1
if the client disconnectedsocket.getInetAddress().isReachable(int timeout)
: From isReachable(int timeout)
Test whether that address is reachable. Best effort is made by the implementation to try to reach the host, but firewalls and server configuration may block requests resulting in a unreachable status while some specific ports may be accessible. A typical implementation will use ICMP ECHO REQUESTs if the privilege can be obtained, otherwise it will try to establish a TCP connection on port 7 (Echo) of the destination host.