TCP turns an unreliable packet network into a reliable, ordered byte stream. It uses sequence numbers to identify byte positions, acknowledgements to communicate received progress, timers and duplicate acknowledgements to detect loss, and retransmission to recover missing data. TCP does not guarantee that the physical network never loses packets; it detects and repairs the effects at the transport layer.
Remember the shape, not the sentence
“Imagine mailing numbered pages with receipts. If page 7 is missing, the recipient can say where the gap begins. The sender can then retransmit the missing material rather than restarting the entire shipment.”
Byte-oriented sequence numbers
TCP sequence numbers identify byte positions in the stream, not packet counts. An ACK normally indicates the next byte the receiver expects.
Cumulative acknowledgement
A cumulative ACK such as ACK 5000 communicates that bytes before 5000 have been received in order; later bytes may have arrived out of order but the precise semantics depend on options such as SACK.
Loss recovery
TCP can retransmit after a retransmission timeout. Duplicate ACK patterns can trigger faster recovery mechanisms, and Selective Acknowledgement can tell the sender which blocks arrived.
See the mechanism before you memorize it
One diagram, one causal story, one reconstruction task.
TCP deep dive: handshake, sequence numbers, ACKs, retransmission — causal map
Send
Sender transmits a segment carrying a sequence-numbered range of bytes.
Receive
Receiver validates and buffers bytes.
ACK
Receiver acknowledges the next expected byte position.
Detect loss
Timer or duplicate-ACK evidence suggests a missing segment.
Draw the idea yourself
Rebuild the core flow on a real canvas before moving to the worked walkthrough.
Walk the system
Send
Sender transmits a segment carrying a sequence-numbered range of bytes.
Receive
Receiver validates and buffers bytes.
ACK
Receiver acknowledges the next expected byte position.
Detect loss
Timer or duplicate-ACK evidence suggests a missing segment.
Recover
Sender retransmits and continues the stream.
Sequence math
The ACK is about byte positions. This single idea prevents many off-by-one misunderstandings in packet captures and interview questions.
Segment: SEQ=1000, LEN=500
Receiver ACK → 1500
Meaning: next expected byte is 1500What usually goes wrong
Close the tab. Rebuild it from memory.
Read the question, answer aloud, then reveal.
What does ACK=1500 mean in the simple example?Reveal answer
The receiver is cumulatively acknowledging all bytes before 1500 and expects byte 1500 next.
Why use sequence numbers?Reveal answer
To order the byte stream, detect gaps and match acknowledgements and retransmissions to positions in the stream.
What is SACK for?Reveal answer
Selective Acknowledgement allows the receiver to report non-contiguous blocks that arrived, helping the sender retransmit only missing ranges.
Make this idea travel.
Connect it next to: tcp-handshake • tcp-flow-congestion • tcp-packet-analysis.