TCP 3次握手问题

发布于 2024-10-19 03:46:06 字数 198 浏览 5 评论 0原文

因此,客户端通过向服务器发送带有 seq 的 SYN 数据包来启动 TCP 连接。 # X。然后服务器用 SYN+ACK 响应 X+1。当关闭连接协议生效时,FIN 数据包也是如此。

所以我的问题是为什么服务器会确认 X+1 而不仅仅是 X?我认为 SYN 和 FIN 数据包没有附带任何数据。难道还有其他原因吗?我很困惑为什么服务器会 ACK X+1 而不是 X。

So a client starts a TCP connection by sending a SYN packet to a server with seq. # X. The server then responds with a SYN+ACK for X+1. The same goes for a FIN packet when the close connection protocol is enacted.

So my question is why does the server ACK for X+1 instead of just X? I thought SYN and FIN packets didn't piggyback any data. Is there some other reason for this? I'm confused as to why the server will ACK X+1 instead of X.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

你的呼吸 2024-10-26 03:46:06

正在发送的序列号是下一个预期的序列号。如果没有增加,则回复将表明数据包未被接受,请重新发送。这将以无限循环结束。

SYN 是一种特殊情况,它本身传输信息。 (它初始化目的地的接收计数。)ACK 将针对下一个预期字节 (SYN + 1)。

ACK 计数并不总是增加,并且可能增加超过 1。考虑此交换,其中数据包 2 被延迟并且乱序到达。

Received    ACK
  1          2
  3          2
  4          2
  2          5

The sequence number being sent is the next expected sequence number. If it wasn't incremented, then the reply would indicate that the packet was not accepted, please resend. This would end in an infinite loop.

SYN is a special case that in and of itself transmits information. (It initializes the received count on the destination.) The ACK will be for the next expected byte (SYN + 1).

The ACK count does not always increase, and may increase by more than 1. Consider this exchange where packet 2 is delayed and arrives out of sequence.

Received    ACK
  1          2
  3          2
  4          2
  2          5
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文