Java Socket getTcpNoDelay() methodThe getTcpNoDelay () method of Java Socket class returns the setting for SO_TIMEOUT option if it is enabled, else it returns false. SyntaxParameterNA ReturnThe getTcpNoDelay () method returns a Boolean value 'true' if the TCP_NODELAY is enabled. ThrowsSocketException - if an error is there in the underlying protocol, such as a TCP error. Example 1Test it NowOutput: SO_TIMEOUT option is enabled: true Example 2Test it NowOutput: SO_TIMEOUT option is enabled: false Example 3Test it NowOutput: Exception in thread "main" java.net.SocketException: Socket is closed at java.net.Socket.setTcpNoDelay(Socket.java:979) at com.javaTpoint.JavaSocketGetTcpNoDelayExample3.main(JavaSocketGetTcpNoDelayExample3.java:14) Next TopicJava Socket Class |
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