RecapDifficulty: Advanced1 min

Recap: How TCP Delivers Reliably

Numbered bytes, two windows and a resend make the promise, and waiting for order is its cost.

TCP's promise of a complete, ordered stream rests on a few mechanisms, and each has a cost.

  • Sequence numbers count bytes; the acknowledgement names the next byte expected. A SYN and a FIN each use one number.
  • The handshake, SYN, SYN-ACK, ACK, agrees both starting numbers and costs one round trip.
  • Flow control keeps the sender within the receiver's advertised window.
  • Congestion control keeps the sender within its own estimate of the network's capacity, starting small and cutting on loss.
  • Three duplicate acknowledgements or a timer trigger a retransmission.
  • Closing takes a FIN in each direction, and the side that closes first waits in TIME_WAIT.
  • Head-of-line blocking stalls every byte behind a loss, and reuse saves the cost of new connections.
Each mechanism, what it guarantees, and what it costs
MechanismGuaranteesCosts
Sequence numbers and acknowledgementsEvery byte accounted forA header field and replies in return
HandshakeBoth ends agree on numberingOne round trip before data
Flow controlThe receiver is never overrunThe sender waits on a slow reader
Congestion controlThe network is not overloadedA slow start and cuts after each loss
Retransmission and orderingNo gaps, no reorderingEverything behind a loss waits