Java Socket getSoLinger() methodThe getSoLinger () method of Java Socket class returns the setting if the SO_Linger option is set else it returns -1 if the option is disabled. This method only affects the setting for SO_LINGER. SyntaxParameterNA ReturnThe getSoLinger () method returns the setting for SO_LINGER option. ThrowsSocketException - if an error is there in the protocol, such as a TCP error. Example 1Test it NowOutput: Send Buffer size: -1 Example 2Test it NowOutput: Send Buffer size: -1 Example 3Test it NowOutput: Exception in thread "main" java.lang.IllegalArgumentException: invalid value for SO_LINGER at java.net.Socket.setSoLinger(Socket.java:1021) at com.javaTpoint.JavaSocketGetSoLingerExample3.main(JavaSocketGetSoLingerExample3.java:13) 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