Introduction to the Transport Layer
Layers 1 to 3 get data from one device to another. The transport layer (Layer 4) is the first one that cares about which program inside each device gets the data — and whether the data arrives complete. This lesson builds the mental model of segmentation, ports, sockets, and the two transport protocols, TCP and UDP.
The role: end-to-end services
The lower three layers answer logistics questions. Physical (1): how is a bit put on the wire? Data link (2): how does a frame cross this one link? Network (3): how does a packet travel across many networks to the right device? When the packet reaches the destination device, the lower layers are finished. But the device is running dozens of programs — a web browser, an email client, a voice call, a file transfer. Something must decide which of those programs receives the payload, and must guarantee the payload arrived whole. That something is the transport layer.
End-to-end
Provide end-to-end services between two applications running on two hosts.
Segmentation
Cut application data into numbered chunks at the sender; reorder and rebuild it at the receiver.
Port numbers
A 16-bit number (0–65535) that selects which application gets the data.
Sockets
An IP address plus a port number, written IP:port.
Multiplexing
Interleave segments from many applications onto one link, then de-multiplex on arrival.
Two protocols
TCP is connection-oriented and reliable; UDP is connectionless and best-effort.
“End to end” (host to host at the application level) distinguishes L4 from the layer below it. The network layer moves a packet between two IP addresses. The transport layer moves data between two applications at those addresses. A router forwarding a packet touches the network layer and never looks inside the segment; the transport header is only read at the two end hosts. This is why transport is sometimes called a host-to-host layer (RFC 1122 calls it the transport layer of the host internetwork model).
Segmenting and reassembling data
Applications hand the transport layer a stream of data — a large file, a web page, a message. The transport layer does not try to push that entire block into one network-layer packet; network payloads are limited. Instead it segments the data into smaller pieces that fit inside IP packets:
- Segmentation — the sending transport layer cuts the application data into chunks and numbers each one with a sequence number, so the order can be restored.
- Reassembly — the receiving transport layer collects the chunks, reorders any that arrived out of sequence, and delivers the reconstructed stream to the application.
Why segment at all? Three practical reasons. First, a maximum transmission unit (MTU) bounds how big a payload one link can carry; IP packets that exceed the path MTU must be fragmented, which is inefficient. Second, segmentation lets a partial failure stay partial: if one segment is lost, only that segment is retransmitted, not the whole file. Third, segments from one conversation can be interleaved with segments from another, which is what makes multiplexing possible.
Port numbers and sockets
To deliver data to the right application, the transport layer uses a port number: a 16-bit number, so it ranges from 0 to 65535. Every segment/datagram carries two of them in its header:
- Source port — the port the sending application is using (top ephemeral number).
- Destination port — the port the receiving application listens on (bottom well-known number, e.g. 80 for web).
A socket is the IP address and port number together, written in the form IP:port — for example 192.168.1.10:55001. Four numbers identify one conversation uniquely:
The destination port selects the application on the server (the well-known port, e.g. 80 for web). The source port distinguishes which conversation at your PC each reply belongs to — two browser tabs both talking to port 80 would be identical except for the source port, so the transport layer gives each one a different source port. This is exactly what Week 1’s encapsulation lesson described: “the Transport layer adds port numbers so the right application gets the data.”
Multiplexing: many conversations, one link
Your PC can simultaneously download a web page, check email, run a DNS lookup, and carry a voice call. All four conversations produce segments from the same host, and all four must travel down the same Ethernet link. The transport layer achieves this by multiplexing: it interleaves segments from many applications onto one stream (distinguished by port numbers) and on arrival de-multiplexes, handing each segment to the correct application.
Notice what the source port does: 55001 through 55004 are ephemeral (temporary) ports chosen by the client, while 80, 25, 53, and 5060 are the well-known ports the server applications listen on. Lesson 2 covers the port ranges and the well-known port table in full.
Two protocols: TCP and UDP
The transport layer has exactly two protocols you must master:
| Feature | TCP | UDP |
|---|---|---|
| Full name | Transmission Control Protocol | User Datagram Protocol |
| Connection | Connection-oriented — establishes a session before sending data | Connectionless — sends each datagram independently |
| Reliability | Reliable — ACKs, retransmits, reorders | Best-effort — no ACK, no retransmission |
| Ordering | In-order delivery guaranteed | No ordering; application may see datagrams out of order |
| Overhead | High (20-byte header minimum + handshake) | Low (8-byte header, no setup) |
| Best for | Files, email, web (where loss or reorder is unacceptable) | Voice, video, DNS, live streaming (where low delay matters more than loss) |
Why keep a “unreliable” protocol at all? UDP’s price is its virtue: no three-way handshake, no ACK timer, no sequence bookkeeping. A voice call would rather drop a fraction of a second of audio than replay a retransmitted packet and resync the conversation. Lesson 3 examines how TCP earns its reliability.
Reliability: L4 versus L2
This is a classic confusion point, so read slowly. Both Layer 2 and Layer 4 do error checking — but at different scopes.
| Layer | Scope | Mechanism | What it detects |
|---|---|---|---|
| Data link (2) | One link, hop by hop | Frame Check Sequence (FCS) trailer, checked & rebuilt at every switch/router hop | Corruption of the frame on that one link |
| Transport (4) — TCP | End to end, host to host | Header checksum + sequence numbers + ACK/retransmission | Loss, corruption, reordering, or duplication across the whole path |
The FCS only proves the frame survived the last link. A frame can still be dropped by a congested router queue, corrupted through an entire router stack, or lost in the middle of the Internet where no single link layer sees it. Link-layer checks, therefore, are necessary but not sufficient. The transport layer rechecks the entire segment end to end — and TCP goes further and recovers. This is the model you met in Week 5: the data-link layer guarantees delivery across one link (see Week 5, Lesson 5 — Data Link Layer in depth); the transport layer guarantees delivery between the two end applications.
PDU names: segment and datagram
Exams demand exact vocabulary (you learned this pattern in Week 1, Lesson 18):
- TCP’s PDU is a segment (TCP header + application data).
- UDP’s PDU is a datagram (UDP header + application data).
- Once the transport PDU is placed inside the IP header, it becomes a Layer 3 packet, and inside the Ethernet header, a Layer 2 frame.
Key terms
| Term | Meaning |
|---|---|
| Transport layer | OSI Layer 4; provides end-to-end services between applications, using ports to identify them. |
| Segmentation | Cutting application data into numbered chunks at the sender. |
| Reassembly | Reordering and rebuilding the original stream at the receiver. |
| Port number | A 16-bit identifier (0–65535) selecting which application gets the data. |
| Socket | An IP address and port number together, written IP:port. |
| Multiplexing | Interleaving segments from many applications onto one link. |
| De-multiplexing | At the receiver, routing each segment to the correct application. |
| TCP | The connection-oriented, reliable transport protocol; its PDU is the segment. |
| UDP | The connectionless, best-effort transport protocol; its PDU is the datagram. |
Review
Check what you have learned with these review questions.
Sources & references
- Postel, J. RFC 793: Transmission Control Protocol (1981), functions of the transport layer and the segment. rfc-editor.org/rfc/rfc793.
- Cotton, M., Eggert, L., Touch, J., Westerlund, M. & Cheshire, S. RFC 6335: Internet Assigned Numbers Authority (IANA) Procedures for the Management of the Service Name and Transport Protocol Port Number Registry (2011). rfc-editor.org/rfc/rfc6335.
- IANA. Service Name and Transport Protocol Port Number Registry. iana.org.
- Braden, R. RFC 1122: Requirements for Internet Hosts — Communication Layers, Section 4 (“TRANSPORT LAYER PROTOCOLS”). rfc-editor.org/rfc/rfc1122.
- Cisco. CCNA (200-301) Exam Topics, Network Fundamentals. cisco.com.
Target exams: CCNA 200-301 v1.1 · CyberOps Associate 200-201. Last content verification: 2026-10-11.