2015-08-19 71 views
1

如何生成序列號?比方說,發送方發送2個分組:需要幫助瞭解TCP序列號和ACK編號

SEQ數:68 ACK編號:69長度:62個字節
SEQ號:130的ACK號:131長度:62個字節

再從reciever臨危分組序列號131 og ACK編號130,下一次發送者發送數據包的順序號是什麼?它是131 + 62 = 193?

回答

1

「當一個主機發起TCP會話,其初始序列號實際上是隨機的;它可以是0和4294967295之間的任意值,包括端值。」

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 
+0

因此不能計算它? – user4118143

+0

初始序列由Host A的OS隨機生成。由於主機B尚未響應,所以初始確認號碼設置爲零。當主機B響應它的操作系統將產生一個Seq#並且該確認號碼變成主機作爲Seq#。在我的示例中,每個交互只會將這些初始數字迭代爲1. – Joey

+0

;下一次發送者發送一個數據包的序列號將是131? – user4118143