How TCP establish and close connection?
TCP establish connection #
TCP close connection #
Why TCP has TIME_WAIT? #
Client normally waits for 2 maximum segment lifetime (MSL) and close the connection. There are two main reason:
- Ensure all old packets is disapper on the internet.
- ACK from client might lose due to the network. Therefore, server will resend
FIN
after timeout. If client closes the connection immediately, client can’t receive the newFIN
.