Chapter 5
The Transport Layer
Where IP's best-effort packets become a usable transport: ports and sockets, UDP's send-and-forget, and the TCP machinery — handshake, reliability, flow control, congestion control, and the lifecycle tuning that decides real performance.
IP delivers addressed packets to a host and stops there. The transport layer is what turns that into something a program can use: it picks the right process out of the thousands on a machine, and — if you ask for it — rebuilds the ordering and reliability the network threw away. Everything above this layer assumes the transport already solved those problems; everything below it assumes nothing.
Two protocols split the work. UDP adds ports and a checksum to IP and otherwise gets out of the way, which is exactly what DNS, VoIP, and QUIC want. TCP does the opposite — a handshake, sequence numbers, acknowledgments, retransmission, a sliding window, and congestion control — to hand the application an ordered, reliable byte stream. The seven topics here trace that machinery from the socket the kernel demultiplexes to the TIME_WAIT pileup that exhausts your ports under load.
Topics in This Chapter
(IP, port), and the 5-tuple the kernel uses to demultiplex each packet to exactly one connection — plus how one listening port serves thousands of clients.SYN / SYN-ACK / ACK exchange that synchronizes sequence numbers, the state machine from LISTEN to ESTABLISHED, and the four-way teardown — and why connecting always costs at least one RTT.cwnd and rwnd, and window scaling for long-fat networks — protecting the receiver, not the network.cwnd — plus loss-based CUBIC versus model-based BBR, why BBR wins on lossy paths, and the fairness debate it started.