List of utility methods to do Socket Check
boolean | isConnected(Socket socket) is Connected return socket != null && socket.isBound() && !socket.isClosed() && socket.isConnected()
&& !socket.isInputShutdown() && !socket.isOutputShutdown();
|
boolean | isSocketClosed(SocketException e) is Socket Closed return e.getMessage().equals("Socket closed"); |
boolean | isSocketReadyToWrite(Socket socket) Determines if the socket can be written to. OutputStream out = socket.getOutputStream(); try { out.write(0); out.flush(); out.write(0); out.flush(); } catch (SocketException e) { return false; ... |
boolean | isSocketTimeoutException(final InterruptedIOException e) If SocketTimeoutExceptionClass is defined, returns true only if the exception is an instance of SocketTimeoutExceptionClass. return e instanceof SocketTimeoutException; |