What happens to client Sockets when I close a ServerSocket? Will all connections made with serverSocket.accept() be closed as well?
Closing a ServerSocket
will prevent new connections from being created, but it won't shut down existing connections.
ServerSocket
is the listening socket involved only in creating a connection. The data communication is handled distinctly in the Socket
returned by ServerSocket.accept();
.