The transport layer is the layer of a network architecture that provides end-to-end communication between processes running on different hosts, sitting above the network layer and below the session and application layers. In networking fundamentals it is known as layer 4 of the OSI model, and in the TCP/IP model it is the layer where TCP, UDP and QUIC operate.
Where the network layer moves packets from one host to another, the transport layer decides which application receives the data and how reliably it arrives. It turns an unreliable, best-effort packet service into whatever the application needs: an ordered, reliable byte stream, a fast datagram service, or something in between.
What the transport layer does
The transport layer performs a small set of functions that the lower layers deliberately leave out. Not every protocol implements all of them, and the choice of functions defines the character of each transport protocol.
- Multiplexing and demultiplexing: many applications share one IP address, and port numbers (0 to 65535) identify the sending and receiving process.
- Segmentation and reassembly: application data is split into segments (TCP) or datagrams (UDP) that fit the path MTU, then rebuilt at the receiver.
- Reliability: sequence numbers, acknowledgments and retransmission timers recover lost or corrupted data.
- Flow control: a receive window prevents a fast sender from overrunning a slow receiver.
- Congestion control: the sender adapts its rate to the capacity of the network path.
- Error detection: a checksum covers the header, payload and a pseudo-header of IP addresses.
The combination of source IP address, source port, destination IP address, destination port and protocol is called the 5-tuple. It uniquely identifies a transport connection or flow, which is why firewalls, NAT devices and load balancers track traffic at this level.
Main transport layer protocols
Four protocols account for nearly all transport traffic, and they differ mainly in connection handling, ordering and reliability. The following table compares them on the properties engineers check first.
| Protocol | Connection model | Reliability and ordering | Typical use |
|---|---|---|---|
| TCP | Connection-oriented, three-way handshake | Reliable, ordered byte stream | Web, email, file transfer, databases |
| UDP | Connectionless | None; datagrams may be lost or reordered | DNS, VoIP, gaming, streaming, DHCP |
| QUIC | Connection-oriented over UDP | Reliable, ordered per stream | HTTP/3, modern web and mobile apps |
| SCTP | Connection-oriented, multi-homed | Reliable, ordered or unordered per stream | Telecom signaling, some data centers |
TCP is defined in RFC 9293 and remains the default for applications that need every byte delivered intact. UDP adds only ports and a checksum to IP, which makes it the foundation for real-time media and for protocols that build their own reliability. QUIC, standardized in RFC 9000, runs in user space over UDP and integrates TLS 1.3 encryption into the handshake.
How reliability and flow control work
Reliable transport depends on sequence numbers and acknowledgments. TCP numbers every byte, and the receiver returns a cumulative acknowledgment naming the next byte it expects. If an acknowledgment does not arrive before the retransmission timeout (RTO), or if three duplicate acknowledgments arrive, the sender retransmits the missing data.
Throughput is bounded by the bandwidth-delay product: to keep a 1 Gbit/s path with 50 ms round-trip time full, roughly 6 MB of data must be in flight. This is why window scaling and modern congestion control algorithms such as CUBIC and BBR matter on long, fast paths. The table below lists the key parameters and their effect.
| Parameter | Typical range | What it affects |
|---|---|---|
| Maximum segment size | 536 to 1460 bytes on Ethernet paths | Payload per segment and fragmentation risk |
| Receive window | 64 KB to several MB with scaling | Maximum unacknowledged data in flight |
| Retransmission timeout | 200 ms to about 1 s minimum, adaptive | Recovery speed after loss |
| Round-trip time | Under 1 ms in a LAN, 20 to 300 ms on WAN | Throughput ceiling and handshake latency |
| Ephemeral port range | 49152 to 65535 per IANA | Number of concurrent outbound connections |
A frequent misconception is that a reliable transport guarantees delivery. It guarantees only that data arrives in order without gaps or that the application is told the connection failed; it cannot deliver across a broken path.
The transport layer in the OSI and TCP/IP models
The transport layer is the first truly end-to-end layer: routers in the middle of the path normally inspect only up to layer 3, while transport headers are processed by the two end hosts. In practice, middleboxes such as firewalls, NAT gateways and load balancers also read and sometimes rewrite layer 4 headers, which complicates the introduction of new protocols and partly explains why QUIC is encrypted and carried over UDP.
Each layer adds its own header during encapsulation, and the data unit takes a different name at each level. The table shows where layer 4 fits among its neighbors.
| Layer | Data unit | Addressing | Example protocols |
|---|---|---|---|
| Application (layers 5 to 7) | Message | Names, URLs | HTTP, DNS, SMTP |
| Transport (layer 4) | Segment or datagram | Port numbers | TCP, UDP, QUIC |
| Network (layer 3) | Packet | IP addresses | IPv4, IPv6, ICMP |
| Data link (layer 2) | Frame | MAC addresses | Ethernet, Wi-Fi |
Choosing a transport and avoiding common problems
The right transport depends on whether the application values completeness or timeliness. A late audio sample is useless, while a missing byte in a file is fatal. The decision table summarizes common cases.
| Situation | Recommended transport | Reason |
|---|---|---|
| File transfer or database replication | TCP | Every byte must arrive in order |
| Voice or video calls | UDP with RTP | Low latency matters more than lost packets |
| Web traffic over lossy mobile links | QUIC | No head-of-line blocking between streams |
| Short request and response queries | UDP | Avoids handshake overhead |
Typical layer 4 faults include port exhaustion on busy proxies, head-of-line blocking when one lost TCP segment stalls all multiplexed requests, and MTU black holes where oversized segments are silently dropped because ICMP is filtered. Diagnosis usually starts with packet captures, connection state tables and retransmission counters.
Stripped to the essentials
Think of a large office building with a single street address. The postal service brings letters to the building, but someone inside must deliver each letter to the right person. The transport layer is that internal mail desk: the building address is the IP address, and the room number is the port number.
Some deliveries need a signature and a resend if anything goes missing, which is what TCP provides. Others are like flyers pushed under doors, quick but without checks, which is how UDP works. The key idea is that layer 4 matches each piece of data to the right program and decides how carefully it is delivered.
Where it is applied
A network administrator at a mid-sized company receives complaints that video meetings stutter while large backups run to a remote data center. A packet capture shows the backup traffic using TCP with large windows, filling the 200 Mbit/s WAN link, while the meeting software sends audio and video over UDP on a dedicated port range.
Because the two applications are distinguishable by their transport ports, the administrator configures quality of service rules that prioritize the UDP media ports and cap the backup flows. The backups finish about twenty minutes later than before, but meeting quality becomes stable, and retransmission counters on the backup sessions stay low because TCP congestion control simply adapts to the reduced share of bandwidth.