Java ServerSocket close() methodThe close() method of ServerSocket class is used to close this socket. Any thread currently blocked in accept() will throw a SocketException. The associated channel is also closed by it if it has any. SyntaxSpecified by:close in interface AutoCloseable Specified by:close in interface Closeable Throws:IOException - if an I/O error occurs when closing the socket. Example 1Server Application Output: Client Application: Output: Example 2:Server Application Output: Client Application: Output:
Next TopicJava ServerSocket
|