如果我关闭ServerSocket,ServerSocket接受的套接字是否也会关闭?

时间:2016-04-03 00:38:15

标签: java sockets serversocket

ServerSocket serverSocket = new ServerSocket(some_port);
Socket socket = serverSocket.accept();
serverSocket.close();

socket也会被关闭吗?

1 个答案:

答案 0 :(得分:7)

没有。接受的Sockets完全独立于接受的ServerSocket