Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TCP sequence number question

Tags:

tcp

This is more of a theoretical question than an actual problem I have.

If I understand correctly, the sequence number in the TCP header of a packet is the index of the first byte in the packet in the whole stream, correct? If that is the case, since the sequence number is an unsigned 32-bit integer, then what happens after more than FFFFFFFF = 4294967295 bytes are transferred? Will the sequence number wrap around, or will the sender send a SYN packet to restart at 0?

like image 838
Meta Avatar asked Apr 20 '10 05:04

Meta


1 Answers

The sequence number loops back to 0. Source:

alt text

TCP sequence numbers and receive windows behave very much like a clock. The receive window shifts each time the receiver receives and acknowledges a new segment of data. Once it runs out of sequence numbers, the sequence number loops back to 0.

Also see chapter 4 of RFC 1323.

like image 112
Eli Bendersky Avatar answered Oct 03 '22 22:10

Eli Bendersky