Class ConnectException in Java

Share and Enjoy !

Class ConnectException in Java

ConnectException signals that a socket could not be connected to a remote address and port. This means that the remote host could be reached, but is not responding, perhaps because there is no process on that host that is listening on the specified port.

A ConnectException is thrown when a socket connection cannot be established with a remote machine. This type of exception usually indicates that there is no listening process on the remote machine.

The class structure of  class ConnectException is given as

public class java.net.ConnectException extends java.io.SocketException{
// Public Constructors
public ConnectException(String msg);//This constructor create a ConnectException with the specified detail message.
public ConnectException();//This constructor creates a ConnectException with no associated detail message.
}

The class ConnectException also inherits methods from class Object and Throwable.

From Object classFrom Throwable class
clone()fillInStackTrace()
getClass()getMessage()
notify()printStackTrace()
wait()printStackTrace(PrintWriter)
wait(long, int)getLocalizedMessage()
wait(long)printStackTrace(PrintStream)
equals(Object)
toString()
finalize()
hashCode()
notifyAll()

Share and Enjoy !

READ  Class PipedInputStream in Java

Leave a Reply

Your email address will not be published. Required fields are marked *