TCP Sequence Number Wraparound Time at 2 Mbytes/sec
In TCP, the Sequence Number identifies the byte stream position. The sequence number field is 32 bits, so it conceptually wraps modulo bytes: after reaching , the next increment goes back to 2.
Given:
- Sending rate: Mbytes/sec
- Initial sequence number value: starts with , i.e., we model it as
- We want the time until the sequence number returns to zero
We interpret “goes back to zero” as the sequence number field wrapping after the sender transmits enough data bytes such that the sequence number advances by bytes (because wrap is modulo ) 2.
We compute:
- Remaining bytes until wrap from to (inclusive wrap accounting):
- Convert the rate Mbytes/sec to bytes/sec: Here we use Mbyte bytes (common in such problems unless stated otherwise):
- Time:
Mermaid intuition for wraparound:
Footnotes
-
RFC 793 — Transmission Control Protocol - Defines the TCP sequence number field and sequence space behavior. ↩ ↩2
-
RFC 793 — Sequence Numbers (32-bit) and wraparound behavior - Specifies the 32-bit nature and modulo arithmetic for sequence handling. ↩ ↩2
Compute time until TCP sequence number wraps to 0
- 1Step 1
TCP sequence numbers are 32-bit and wrap modulo , so returning to 0 occurs after advancing by bytes from a given starting point 2.
Footnotes
-
RFC 793 — Transmission Control Protocol - Defines the TCP sequence number field and sequence space behavior. ↩
-
RFC 793 — Sequence Numbers (32-bit) and wraparound behavior - Specifies the 32-bit nature and modulo arithmetic for sequence handling. ↩
-
- 2Step 2
If the sequence number starts at , the remaining advancement to wrap is bytes.
- 3Step 3
With Mbytes/sec and using Mbyte bytes, the rate is bytes/sec.
- 4Step 4
Time is seconds; evaluate numerically for the final answer.
- 5Step 5
Provide the value in seconds (and optionally convert to hours/days for intuition).
Now evaluate:
Convert to hours:
Answer:
[
\boxed{t \approx 2.15\times 10^3\ \text{seconds} \approx 35.8\ \text{minutes}}
]
(Using Mbyte bytes.)
Note on units: If your course instead uses MiB bytes, the time will be slightly larger. The modulo logic is the core part 2.
Footnotes
-
RFC 793 — Transmission Control Protocol - Defines the TCP sequence number field and sequence space behavior. ↩
-
RFC 793 — Sequence Numbers (32-bit) and wraparound behavior - Specifies the 32-bit nature and modulo arithmetic for sequence handling. ↩
Key idea: wrap is based on bytes, not segments
TCP sequence numbers count the byte positions in the TCP byte stream, so wrap time depends on the number of octets sent (data bytes plus any SYN/FIN semantics per the TCP state), and here we assume pure data bytes at a constant rate .
Footnotes
-
RFC 793 — Transmission Control Protocol - Defines the TCP sequence number field and sequence space behavior. ↩
Be careful about how Mbytes/sec is defined
Some problems assume Mbyte bytes (decimal). Others use MiB bytes. The final numeric time changes, but the method and the modulo wrap remain the same 2.
Footnotes
-
RFC 793 — Transmission Control Protocol - Defines the TCP sequence number field and sequence space behavior. ↩
-
RFC 793 — Sequence Numbers (32-bit) and wraparound behavior - Specifies the 32-bit nature and modulo arithmetic for sequence handling. ↩
TCP sequence number lifecycle (wrap intuition)
Start
t = 0Sequence number begins at 7000."
Transmit bytes
t increasesSequence number advances with the byte stream."
Wraparound
after $2^{32}-7000$ bytesSequence number modulo returns to 0."
Wrap timing breakdown (decimal Mbyte assumption)
Illustrative values used in the calculation
Common pitfalls & extensions
Knowledge Check
TCP sequence numbers wrap because the sequence number field is: