A.Cho
A.Cho

Reputation: 593

when the server's child close socket

On the concurrent server, server spawns many children(assume that I am using multiple process when clients connet). So, if client close sockets(close() function), it sends FIN to server and receive ACK from the server.

Finally, server's read() function returns 0 and exit() function is called. It causes server child to terminate and close socket, and send FIN to its client.

In this situation, how can server receive ACK even though server's child socket is closed? and how can server re-send FIN when client doesn't receive the FIN even though there is no connected socket because of child which is terminated?

Does kernel keep that terminated process's socket until finishing final four-handshaking although it is closed?

Upvotes: 0

Views: 158

Answers (2)

SergeyA
SergeyA

Reputation: 62563

Yes, close() on sockets is normally asynchronous, and sockets can linger after application is terminated. You can easily see them in netstat output in their approriate state (for example, TIME_WAIT or FIN_WAIT2).

Upvotes: 1

user207421
user207421

Reputation: 310885

Yes it does. close() is normally asynchronous.

Upvotes: 1

Related Questions