TCP/IP Illustrated vol1 笔记 2MSL Wait State

1. 名词解释:

incarnation : New instances of a connection are called incarnations of that connection (p243)

也就是连接的四个要素都一样的不同连接实例

ISN:Initial Sequence Number (p231)

2. TIME_WAIT state

当主动发起连接(close)的一端,接收到对端的FIN后,发出对应的ACK,需要等待 2MSL 的时间,这段时间发起主动关闭的这一端处于 TIME_WAIT state;

设置 2MSL的原因是这么解释的:

Given the MSL value for an implementation, the rule is: when TCP performs an active close, and sends the final ACK, that connection must stay in the TIME_WAIT state for twice the MSL. This lets TCP resend the final ACK in case this ACK is lost (in which case the other end will time out and retransmit its final FIN).

但是这里并没有充分说明 2MSL 的合理性,这需要TCP的重传机制的进一步解释。


3. MSL

Maximum Segment Lifetime 即一个指定的segment消亡时间,RFC 中指定 2分钟,具体实现有 30s和2分钟;


4.

处于 TIME_WAIT state 的 2MSL 这段时间的主机(只是发起主动连接的一端,另一端在接受到ACK后,已经没有限制了),不能重用以前的端口和链接,实验中揭示了一些实现上的不同;(p246)

1. 通过 SO_REUSEADDR 选项,可以重用原来的端口,但是本地发起连接到原来的对端(建立一个incarnation),会出错;(p246)

2. 在这期间,从原来另一端的主机和端口,连接到这台主机;在 Berkeley-Derived 的实现中,居然成功连接了,即一个新的 incarnation 在 TIME_WAIT 期间建立了,这里只有一个ISN的限制,就是必须大于FSN;(当然,其他的机器连过来更不是问题了)(p246)

所以,berkeley-derived的实现中,服务器主动关闭,并重启,在2MSL期间并不影响其服务。                                                                                                       





  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值