The engine room, managing segment assembly, error correction, and application sockets.
PDU: Segment (TCP) / Datagram (UDP)
Focus: End-to-End Reliability
Hardware: OS Kernel / Sockets
Core Purpose & Function
While the Network Layer below routes packets to the correct *physical computer*, the Transport Layer is the one that gets the data to the correct *software process* on that computer. It acts as the supervisor of the connection, handling flow control, sequencing, and packet loss recovery.
Key Responsibilities
Port Addressing & Multiplexing: Attaching source and destination ports. This allows a laptop to run Slack, Zoom, and a browser simultaneously without their data streams mixing.
Segmentation & Reassembly: Dividing data into chunks size-optimized for the MTU (Maximum Transmission Unit) of the network, and re-assembling them in order at the destination.
Flow Control: Preventing a fast sender from overwhelming a slow receiver by negotiating window sizes.
Error Recovery & ACKs: Using checksums to spot corruption and retransmitting lost packets when timers expire.
TCP vs UDP — The Transport Split
| Feature | TCP (Transmission Control Protocol) | UDP (User Datagram Protocol) |
|---|---|---|
| Connection | Connection-oriented (Requires 3-Way Handshake) | Connectionless (Fire and Forget) |
| Reliability | Guaranteed delivery (Retransmits lost segments) | Best-effort delivery (No retransmission) |
| Ordering | Guaranteed in-order reassembly | No ordering guarantees |
| Header Size | 20 bytes minimum | 8 bytes fixed |
| Use Case | Web browsing (HTTP), Email, File transfer (FTP) | Voice calls (VoIP), Video streams, DNS |