Online Java Compiler By
JavaTpoint.com
import java.io.IOException; import java.net.*; public class JavaSocketShutdownOutputExample2 { public static void main(String[] args) throws IOException { //calling the constructor of the socket class Socket socket = new Socket(); //shutdownOutput() method disables the output stream for the specified socket. //the socket should be connected else it will throw an SocketException socket.shutdownOutput(); //isOutputShutdown() returns if the write-half of the socket connection is closed. System.out.println("output is shutdown: "+socket.isOutputShutdown()); } }
Output