gpt4 book ai didi

networking - TCP 建立连接

转载 作者:可可西里 更新时间:2023-11-01 02:54:38 24 4
gpt4 key购买 nike

我想知道为什么我们3次握手,为什么我们只用2次握手连接。

最佳答案

来自 Ans :

The ACK is accompanied by sequence numbers. The RFC is pretty clear on the handshake:

1) A --> B SYN my sequence number is X

2) A <-- B ACK your sequence number is X

3) A <-- B SYN my sequence number is Y

4) A --> B ACK your sequence number is Y

Steps 2 and 3 are combined in a single packet.

The thing about it is that step 4 is also what is used to move the TCP window.
By including that step you are using the regular protocol in the initialization process. It is basically just zeroing out the transmission windows.

You aren't blocked from sending data along with step 4.

You could send data with your first ACK if you wanted to, essentially saying "I received packets up to Y, here is some data".

enter image description here

正如我们在上图中看到的,当客户端从服务器收到 ACK 时,客户端连接完成,但服务器端连接仍保持未完成状态,直到服务器未收到来自客户端的 ACK。

正如@EJP,在上面的评论中说我们需要两个序列号,因为公共(public)序列号会导致许多不一致。

关于networking - TCP 建立连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20906171/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com