Java Socket getTrafficClass() methodThe getTrafficClass() method of Java Socket class returns the traffic class or type-of-service in the IP header sent from the specified Socket. SyntaxParameterNA ReturnThe getTrafficClass () method returns the traffic class or type-of-service. ThrowsSocketException - if there occurs an error while obtaining the traffic class or type-of-service value. Example 1Test it NowOutput: Traffic class: 88 Example 2Test it NowOutput: Exception in thread "main" java.net.SocketException: Socket is closed at java.net.Socket.setTrafficClass(Socket.java:1380) at com.javaTpoint.JavaSocketGetTrafficClassExample3.main(JavaSocketGetTrafficClassExample3.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