Class SocketException in Java

Class SocketException in Java

SocketException is thrown from the application to indicate that some exception happened while attempting to use a socket.

A SocketException is thrown when an error occurs while a socket is being used. As of now, there are some more specific subclasses of SocketException, namely BindException, ConnectException, and NoRouteToHostException.

The class SocketException is given below:

public class java.io.SocketException extends java.lang.IOException{
//constructor
public SocketException();//constructs an empty SocketException object that is an object with no message specified.
public SocketException(String message);//constructs an SocketException object with the message specified.
}

The class SocketException 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  EventObject Class in Java

Leave a Reply

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