When either the Server A or Client B closes the connection, the connection is closed for the sockets on both. The client will need to initialize a new connection in order for a new socket c to be created. ServerSocket.accept() will only return when the client explicitly requests a new connection.