TCP TIME_WAIT问题
我读过一本TCP和socket编程书。我有一个问题,
TCP的TIME_WAIT状态应该保持2MSL时间段为 书上说。但是互联网如何探索类似的应用程序 没有这个问题吗?
根据文档,是 4 分钟,但是在 Internet explorer 中 我什至不需要等待 10 秒来刷新网页?
这是如何运作的?我很困惑请解释一下。
I have read a TCP and socket programming book. I have a question,
The TIME_WAIT state of the TCP should remain 2MSL time period as
the book said. But how then a internet explore like application
does not have this problem?
According to the documentation, it's 4 minutes , but in Internet explore
I don't have to wait even 10 seconds to refresh a web page?
How this works? I'm confused please explain.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有几种可能性,我在下面列出了其中一些。
首先,并非所有会话都进入 TIME_WAIT 状态。如果对方关闭连接,则本地转换为
ESTABLISHED
、CLOSE_WAIT
、LAST_ACK
和CLOSED
,因此有不涉及TIME_WAIT
。其次,
TIME_WAIT
状态适用于会话,它是一个 5 元组{protocol,source-ip,source-port,dest-ip,dest-端口}
。如果这些值中的任何一个在下一个会话(通常是源端口)发生变化,则不会受到上一个会话的影响。
最后,浏览器不必在每次请求后关闭会话。为了重用它们,更有可能(为了效率)维护一个打开的会话池,例如当您想要下载包含五十个图像的页面时(一个会话而不是五十一个)。
它甚至可以在页面完全加载后使此类会话保持打开状态,以防您访问该服务器上的其他内容。
There are a few possibilities, some of which I've listed below.
The first is that not all sessions move through the
TIME_WAIT
state at all. If the other side closes the connection, the local transitions areESTABLISHED
,CLOSE_WAIT
,LAST_ACK
andCLOSED
, so there's noTIME_WAIT
involved.Secondly, the
TIME_WAIT
state applies to a session, which is a 5-tuple{protocol,source-ip,source-port,dest-ip,dest-port}
.If any of those values change for the next session (usually source-port), that's unaffected by the previous session.
Lastly, the browser doesn't have to shut down the session after each request. It's more likely (for efficiency) to maintain a pool of open sessions in order to re-use them, such as when you want to download a page with fifty images (one session rather than fifty one).
It can even leave such sessions open after a page is fully loaded, on the off-chance you'll access something else on that server.