Java Socket Check isConnected(Socket socket)

Here you can find the source of isConnected(Socket socket)

Description

is Connected

License

Open Source License

Declaration

public static boolean isConnected(Socket socket) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.net.Socket;

public class Main {
    public static boolean isConnected(Socket socket) {
        return socket != null && socket.isBound() && !socket.isClosed() && socket.isConnected()
                && !socket.isInputShutdown() && !socket.isOutputShutdown();
    }//from  w  w  w. j a  v  a 2  s .  c  om
}

Related

  1. isSocketClosed(SocketException e)
  2. isSocketReadyToWrite(Socket socket)
  3. isSocketTimeoutException(final InterruptedIOException e)