Java Socket isInputShutdown() method

The isInputShutdown () method of Java Socket class returns a Boolean value 'true' if the read-half of the socket connection has been closed, else it returns false.

Syntax

Parameter

NA

Return

The isInputShutdown () method returns a Boolean value 'true' if the socket has been shut down successfully.

Example 1

Test it Now

Output:

The socket is connected: true
The socket is bounded: true
Input is shutdown: false

Example 2

Test it Now

Output:

Input is shutdown: true

Example 3

Test it Now

Output:

Exception in thread "main" java.net.SocketException: Socket is not connected
	at java.net.Socket.shutdownInput(Socket.java:1523)
	at com.javaTpoint.JavaSocketShutdownInputExample3.main(JavaSocketShutdownInputExample3.java:11)




Latest Courses