Transport layer
The transport layer is the layer of the protocol stack responsible for moving data between processes on different hosts. While the network layer delivers packets from host to host, the transport layer delivers them from process to process — from a web browser on one machine to a web server on another, from an email client to a mail server. It is the layer that transforms the internet from a network of machines into a network of applications.
The transport layer's central abstraction is the port: a numerical identifier that distinguishes different processes on the same host. When a packet arrives at a machine, the operating system uses the port number to determine which application should receive it. This simple mechanism — a 16-bit number — is what allows a single server to handle thousands of simultaneous connections, each belonging to a different user or service.
The two dominant transport-layer protocols are TCP and UDP. TCP provides reliable, ordered, congestion-controlled delivery at the cost of higher latency and connection-state overhead. UDP provides unreliable, unordered, stateless delivery at the cost of requiring the application to handle its own error recovery and ordering. The choice between them is not a technical preference but a systems design decision: applications that cannot tolerate loss (file transfer, email) use TCP; applications that cannot tolerate delay (video streaming, online gaming, DNS queries) use UDP. The transport layer is therefore not a neutral pipe; it is a design space in which the fundamental tradeoffs of distributed systems — reliability vs. latency, state vs. simplicity, control vs. efficiency — are encoded in protocol choice.