RedTeam Nexus Labs
Module 08 · Lesson 03 // TCP & UDP

reliability

TCP & UDP · Networking

Freereading · 10 min
On this page
LESSON

Overview

TCP's defining promise is reliable, ordered delivery: the bytes you send arrive complete, in order, and without duplicates — even across an unreliable network that loses and reorders packets. This lesson explains the mechanisms that make that promise possible.

Learning objectives

  • List the mechanisms TCP uses for reliability.
  • Explain acknowledgements and retransmission.
  • Describe ordering and flow/congestion control at a conceptual level.

Core concept

TCP achieves reliability with a set of cooperating mechanisms:

  • Sequence numbers — every byte is numbered so the receiver can reassemble data in the correct order and detect gaps or duplicates.
  • Acknowledgements (ACKs) — the receiver confirms which bytes it has received.
  • Retransmission — if the sender does not receive an ACK within a timeout (or sees signs of loss), it resends the missing data.
  • Flow control — the receiver advertises a window telling the sender how much it can accept, preventing a fast sender from overwhelming a slow receiver.
  • Congestion control — TCP adjusts its sending rate in response to network congestion to avoid making it worse.

How it works

The sender transmits segments and expects ACKs. Because bytes are sequenced, the receiver can reorder anything that arrives out of order and discard duplicates. Missing segments are detected (no ACK, or duplicate ACKs signaling a gap) and retransmitted. The advertised window and congestion window together bound how much unacknowledged data is in flight, balancing throughput against the receiver's capacity and the network's condition.

Practical example

Downloading a file over TCP, a few packets are lost to momentary congestion. You never see corruption or missing bytes: TCP detects the gaps, retransmits exactly the lost segments, and delivers the file's bytes to the application in perfect order. The application is unaware any loss occurred — that is reliability doing its job invisibly.

Cybersecurity relevance

Reliability mechanisms shape both analysis and attacks. Analysts read retransmissions and duplicate ACKs in captures to diagnose loss or tampering. Historically, attackers abused predictable sequence numbers for session hijacking or injection (modern stacks randomize ISNs to defend against this). Understanding ordering and ACK behavior is essential for interpreting TCP traffic and spotting manipulation.

Common mistakes

  • Assuming TCP prevents all loss — it does not prevent loss on the wire; it recovers from it via retransmission.
  • Conflating flow control with congestion control — one protects the receiver, the other protects the network.
  • Thinking reliability is free — it adds overhead and latency compared with UDP.

Key takeaways

  • TCP guarantees reliable, ordered, duplicate-free delivery over an unreliable network.
  • It uses sequence numbers, acknowledgements, retransmission, flow control, and congestion control.
  • Reliability recovers from loss rather than preventing it, at the cost of extra overhead and latency.

Check your understanding

  • How does TCP recover when a segment is lost in transit?
  • What is the difference between flow control and congestion control?
FINISH THIS LESSON

Sign in to save your progress.