TIME_OUT状态的存在的意义
从图中,很清晰的看到TIME_WAIT状态发生在了active close 端,产生的时间点是发送ACK K+1 分节之后,原因是防止ACK分节在网络中丢失(lost),此时passive close进入LAST_ACK状态,意为等待ACK分节,如果此时ACK分节真的丢失了(passive close端的LAST_ACK超时),那么passive close端将会再次发送一个FIN K分节给对端。这就是为什么在图中,出现两次FIN的分节。
这里有RFC的原文: Once
the final ACK has been sent on an active close, the port/connection
cannot be relaeased and re-used for the time period 2MSL. This is twice
the
maximum segment life and this constraint is imposed in case the the
final ACK is lost. If the final ACK is lost then the passive
closing host will time out awaiting an ACK in response to the closing FIN and will resend the FIN. If
this arrives before the 2MSL time has
expired there is no problem, after this time the FIN does not appear to
belong to whatever connection might exist between the two clients.