需要帮助了解TCP序列号和ACK号

时间:2015-08-19 13:59:50

标签: tcp

如何生成序列号?让我们说发件人发送2个数据包:

序号:68 ACK号码:69长度:62字节
序号:130 ACK号:131长度:62字节

然后收到序列号为131 og ACK号码130的接收方的数据包,下次发送方发送数据包时序列号是多少?是131 + 62 = 193?

1 个答案:

答案 0 :(得分:1)

“当主机启动TCP会话时,其初始序列号实际上是随机的;它可以是介于0和4,294,967,295之间的任何值,包括在内。”

At the sender:
- Send one packet, and keep track of its sequence number and
  transmission time
- Once an ACK is received for that packet, delete the stored
  sequence number, and send a new packet (using the same strategy
  of saving its sequence number and waiting for an ACK)
- If an ACK hasn't been received after timeout seconds since the
  packet's transmission time, retransmit it to the receiver.

 At the receiver:
- Upon receipt of packet k, send an ACK for packet k
- If k is greater than the last sequence number we received (or if
  we haven't received any packets yet), then deliver the packet to
  the application and keep track of k

Example :
Host A: Seq#: 111 Ack #: 0
Host B: Seq#: 222 Ack #: 112
Host A: Seq : 112 Ack#: 223
相关问题