EMZETT.
Login

OSI Layer: Transport

In short: The 4th layer of the OSI model — governs end-to-end transmission between two devices; this is where TCP and UDP sit.

In more detail: While the network layer below (layer 3, IP) only makes sure that packets somehow reach their destination, the transport layer takes care of things like ordering, reliability (TCP) and distinguishing several simultaneous connections via ports.

In Depth

Two fundamentally different types of transmission

The transport layer offers two fundamentally different types of transmission, depending on the application’s needs. TCP is connection-oriented and reliable — before transferring data it establishes a connection via a three-way handshake, guarantees the right order, acknowledges every segment and automatically resends lost packets, which, however, costs additional latency. UDP is connectionless and “best effort” — packets are simply sent off, without a delivery guarantee, ordering guarantee or connection setup, but with minimal overhead and lower latency. The choice between the two depends on the use case: TCP for HTTP/email/file transfer (completeness matters more than speed), UDP for VoIP/video streaming/online gaming/DNS queries (timeliness matters more than a single lost packet, and the connection setup overhead isn’t worth it for short requests).

Ports: from device to application

Ports are the second central concept of this layer: an IP address only identifies the DEVICE on the network, the port additionally identifies the specific APPLICATION on this device — the combination of IP address, port and protocol (TCP or UDP) forms a so-called socket, which uniquely identifies a single connection. Ports in the range 0–1023 are reserved as “well-known ports” for standard services (80 for HTTP, 443 for HTTPS, 22 for SSH); ports from 49152 upwards are typically assigned dynamically as “ephemeral ports” for the client side of a connection.

Segmentation and multiplexing

This layer also allows multiplexing of several simultaneous connections over a single physical network interface: a computer can run a web browser (port 443), an email client (port 993) and an SSH session (port 22) at the same time, even though all data runs over the same IP address — the operating system sorts incoming packets to the right application based on the destination port. Errors at this layer typically show up as “connection refused” (no service is listening on the requested port) or a timeout (a firewall silently blocks the port without returning an error message).

See also: TCP, UDP, Port