对TCP和Unix监听功能中的三向握手的怀疑 [英] Doubt in Three way handshake in TCP and Unix listen function

查看:39
本文介绍了对TCP和Unix监听功能中的三向握手的怀疑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Connect 函数在发送最后一个 ACK​​(发起 TCP 连接的 3 次握手的第 3 段)后返回.如果第 3 段丢失,因为监听仍在服务器端等待 ACK 但客户端没有人再次发送该 ACK,会发生什么情况?

Connect function returns after sending the last ACK(3rd segment of 3-way handshake of initiating TCP connection). What happens if this 3rd segment is lost because listen is still waiting for ACK at server but there is no one at client to send that ACK again ?

推荐答案

如果客户端发送了一个数据包的 ACK,但它丢失了,客户端会注意到数据没有被服务器 ACK 并重新发送数据包.

If the client sends its ACK with a data packet, and it gets lost, the client will notice that the data hasn't been ACKd by the server and resend the packet.

如果客户端在一个单独的数据包中发送它的 ACK,并且它丢失了,服务器会注意到 SYN/ACK 没有被客户端确认并重新发送数据包.客户端将通过重新发送 ACK 进行响应.

If the client sends its ACK in a separate packet, and it gets lost, the server will notice that the SYN/ACK hasn't been ACKd by the client and resend the packet. Client will respond by resending the ACK.

此时应用程序的连接调用是否仍处于阻塞状态并不重要,因为 ACK 是由操作系统的 TCP/IP 实现完成的.

Whether the application's connect call is still blocking at that time doesn't matter, since the ACKing is done by the OS's TCP/IP implementation.

这篇关于对TCP和Unix监听功能中的三向握手的怀疑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆