Active TCP connection creation:
Passive Establishment of TCP connections
Active disconnection
Passive disconnection
In the time_wait stage, MSL must be twice the length of time, that is, maximum segment lifetime, which indicates the maximum time in the network before any packets are discarded: rfc793 indicates that MSL is 2 min, but the commonly used values in implementation are 30 s, 1 min or 2 min. The reason for this is: when the TCP line is closed and the last Ack is returned, the connection must stay in the time_wait status for 2 MSL, this allows TCP to send the last ack again to prevent the ACK from being lost (the other end times out and resends the final fin ).
Another result of MSL waiting for such 2 is that the socket used for connection (SIP: Sport: dip: dport) cannot be used during time_wait, it can only be used after 2msl. However, for the local IP Address: dport, you can set the so_reuseadr option of the socket to bypass this restriction. This is also the reason why the socket listened by the current server will usually set the so_reuseaddr option.
In the time_wait stage, any late message on the link will be discarded.