Java Socket sendUrgentData() methodThe 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. SyntaxParameterThe ?data? parameter represents the byte of data to send. ReturnNA ThrowsIOException - if there is an error while sending the data. Example 1Test it NowOutput: The socket is connected: true Data has been sent successfully... Example 2Test it NowOutput: Exception in thread "main" java.io.IOException: Socket Closed The socket is connected: true at java.net.AbstractPlainSocketImpl.sendUrgentData(AbstractPlainSocketImpl.java:591) at java.net.PlainSocketImpl.sendUrgentData(PlainSocketImpl.java:262) at java.net.Socket.sendUrgentData(Socket.java:1067) at com.javaTpoint.JavaSocketSendUrgentDataExample2.main(JavaSocketSendUrgentDataExample2.java:23) Example 3Test it NowOutput: The socket is connected: false Socket is not connected... Please connect the socket with a valid socket address and port number 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