Java Utililty Methods Socket Check

List of utility methods to do Socket Check

  1. HOME
  2. Java
  3. S
  4. Socket Check

Description

The list of methods to do Socket Check are organized into topic(s).

Method

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;

AltStyle によって変換されたページ (->オリジナル) /