Java Socket isOutputShutdown() method25 Mar 2025 | 2 min read 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. SyntaxParameterNA ReturnThe isOutputShutdown () method would return a Boolean value 'true' if the output of the socket has been shut down. Example 1Output: The socket is connected: true The socket is bounded: true Output is shutdown: true Example 2Output: The socket is connected: true The socket is bounded: true Output is shutdown: false Example 3Output: Exception in thread "main" java.net.SocketException: Socket is not connected at java.net.Socket.shutdownOutput(Socket.java:1553) at com.tpointtech.JavaSocketIsOutputShutdownExample3.main(JavaSocketIsOutputShutdownExample3.java:10) Next TopicJava Socket Class |
Java method The getReceiveBufferSize() method of Java Socket class returns the buffer size (SO_RCVBUF option) for this socket. Syntax public int getReceiveBufferSize () throws SocketException Parameter NA Returns The getReceiveBufferSize() method returns the buffer size or the SO_RCVBUF option for this socket. Throws SocketException - if there is an error in the underlying...
3 min read
Java method The get00BInline() method of Java Socket class tests whether the S0_00BINLINE option is enabled or not. Syntax public boolean get00BInline () Parameter NA Return The get00BInline() method returns a Boolean value 'true if the S0_00BINLINE is enabled else it returns false. Throws SocketException - if an error is there in...
2 min read
Java method connect(SocketAddress endpoint) The connect() method of Java Socket class connects the specified socket to the server. Syntax public void connect(SocketAddress endpoint) throws IOException Parameter The parameter 'endpoint' represents the SocketAddress. Return NA Throws IOException - if an error occurs during the connection. IllegalBlockingModeException - if this socket has an associated channel and the...
5 min read
Java Socket getReuseAddress () method The getReuseAddress () method of Java Socket class tests whether the SO_REUSEADDR option is enabled or not. It throws SocketException if finds an error in the underlying protocol, such as a TCP error. Syntax public boolean getReuseAddress() Parameter NA Return The getReuseAddress () method returns a...
2 min read
Java method The getKeepAlive() method of Java Socket class tests whether SO_KEEPALIVE option is enabled or not. Syntax public boolean getKeepAlive () Parameter NA Return The getKeepAlive() method either returns a Boolean indicating whether SO_KEEPALIVE option is enabled or not. Throws SocketException - if there is an error in the underlying protocol, such...
2 min read
Java method The getInputStream() method of Java Socket class returns an input stream for the given socket. If you close the returned InputStream, then it will close the linked socket. Syntax public InputStream getInputStream () throws IOException Parameter NA Return The getInputStream() returns an input stream for reading bytes...
3 min read
Java method The getChannel() method of Java Socket class returns the unique SocketChannel object linked with this socket. Syntax public SocketChannel getChannel() Parameter NA Return The getChannel() method either returns the socket channel linked with this socket or returns null if the socket was not created for the specified channel. Example...
2 min read
Java method The shutdownOutput() method of Java Socket class disables the output stream for the specified socket. If the socket output stream is written after invoking the shutdownOutput() method on the socket, the stream will throw an IOException. Syntax public void shutdownOutput () throws IOException Parameter NA Return NA Throws IOException...
2 min read
Java method 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...
4 min read
Java method The sendUrgentData() method of Java Socket class sends one byte of urgent data on the socket. The byte should be the lowest eight bits of the data parameter. Syntax public void sendUrgentData (int data) throws IOException Parameter The "data" parameter represents the byte of data to send. Return NA Throws IOException...
4 min read
We request you to subscribe our newsletter for upcoming updates.
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India