Lukas' Notes

network-protocols tcp

Definition

Sequence Number (TCP)

The sequence number is a 32-bit field in the TCP header that identifies the position of the first data byte in the current segment within the sender’s byte stream.

At connection setup, each side picks an initial sequence number (ISN) during the three-way handshake. Subsequent segments carry sequence number = ISN + bytes already sent.

The SYN and FIN flags consume one sequence number each, so a segment that only carries a SYN has sequence number = ISN and the next data byte starts at ISN + 1.