Java Socket shutdownInput() methodLast Updated : 17 Mar 2025 The shutdownInput() method of Java Socket class places the input stream for the specified socket at the end of the stream. When this method is invoked on the socket, the stream's available method returns 0, and its read methods return -1 (end of stream). SyntaxParameterNA ReturnNA ThrowsIOException - if an I/O error occurs while shutting down the given socket Example 1Output: Output The socket is connected: true The socket is bounded: true Input is shutdown: true Example 2Output: The socket is connected: true The socket is bounded: true Input is shutdown: true Example 3Output: Exception in thread "main" java.net.SocketException: Socket is not connected at java.net.Socket.shutdownInput(Socket.java:1523) at com.tpointtech.JavaSocketShutdownInputExample3.main(JavaSocketShutdownInputExample3.java:11) Next TopicJava Socket Class |
We request you to subscribe our newsletter for upcoming updates.

We deliver comprehensive tutorials, interview question-answers, MCQs, study materials on leading programming languages and web technologies like Data Science, MEAN/MERN full stack development, Python, Java, C++, C, HTML, React, Angular, PHP and much more to support your learning and career growth.
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India