Java Socket isOutputShutdown() method

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

Syntax

Parameter

NA

Return

The isOutputShutdown () method would return a Boolean value 'true' if the output of the socket has been shut down.

Example 1

Test it Now

Output:

The socket is connected: true
The socket is bounded: true
Output is shutdown: true

Example 2

Test it Now

Output:

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

Example 3

Test it Now

Output:

Exception in thread "main" java.net.SocketException: Socket is not connected
	at java.net.Socket.shutdownOutput(Socket.java:1553)
	at com.javaTpoint.JavaSocketIsOutputShutdownExample3.main(JavaSocketIsOutputShutdownExample3.java:10)




Latest Courses