Reputation: 231
Let say A
is Server and B
is Client. B
create a socket b
to Server A
and ServerSocket.accept()
create a corresponding socket a
for the client B
now if a
is closed by Server A
but client B
haven't closed its socket b
and ServerSocket.accept()
still running then will ServerSocket.accept()
create another socket c
for client B again?
Upvotes: 0
Views: 308
Reputation: 791
No
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.
Upvotes: 3