Understanding TCP
Build a reliable, ordered byte stream over an unreliable packet network. Observe connection setup, acknowledgement, retransmission and shutdown.
- Default port
- Application dependent
- Transport / carrier
- IPv4 / IPv6
- Category
- core
What to look for in the lab
Jump to the loss step. Compare the sequence number on the lost segment with the one on its retransmission, then find the ACK that advances after delivery. That ACK names the next expected byte.
1. Synchronize sequence numbers
The client sends SYN with its initial sequence number. SYN consumes one sequence number even though it carries no application data here.
2. Acknowledge the handshake
The server replies SYN-ACK and the client acknowledges it. Both directions now have independent sequence spaces.
3. Deliver and acknowledge bytes
An ACK is cumulative: Ack=1004 means all bytes before 1004 have arrived in order. The advertised window limits outstanding data.
4. Recover a lost segment
A missing acknowledgement can trigger retransmission. Retransmitted bytes retain their sequence numbers so a receiver can discard duplicates.
5. Close both directions
FIN closes one sending direction and consumes a sequence number. The peer can finish its own data before closing the opposite direction.
Protocol relationships
Protocols cooperate across layers. Compare the neighboring lessons to distinguish addressing, delivery, application semantics and encryption.
Standards and editorial method
Written and implemented independently by NavSprout. Lessons summarize public protocol standards using synthetic documentation addresses and fictional credentials. Consult the standards for complete wire formats and normative behavior.
RFC 9293 ↗