问题描述
据我了解,关闭TCP连接有两种方式:
The way I understand this, there are 2 ways to close TCP connection:
- 发送 FIN 标志
- 发送 RST 标志
RST 会导致连接立即终止,而在 FIN 中您会得到确认.
RST causes immediate connection termination, while in FIN you get a confirmation.
我的理解是否正确,两者之间还有其他区别吗?这两个标志可以一起使用吗?
Do I understand this right, and are there any other distinctions between the two? Can those 2 flags be used together?
推荐答案
FIN 说:我和你说完了,但我还是会听你说的一切,直到你说你说完了为止."
FIN says: "I finished talking to you, but I'll still listen to everything you have to say until you say that you're done."
RST 说:没有对话.我不会说什么,也不会听你说什么."
RST says: "There is no conversation. I won't say anything and I won't listen to anything you say."
如果您的 TCP 连接持久且流量很小,则 RST 很有用.如果其中一台计算机重新启动,它会忘记连接,而另一台计算机会在发送另一个数据包后立即获得 RST.
RST is useful if you have long lasting TCP connection with little traffic. If one of the computers is restarted, it forgets about the connection, and the other computer gets RST, as soon as it sends another packet.
这篇关于TCP 连接中的 FIN 与 RST的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!