The idea
A datagram arriving at a host has done its job once the network layer delivers it to that machine. But a host usually runs several programs at once — a browser, a mail client, a background update check — and the datagram has to end up at the right one of them. Getting it to the right host and getting it to the right process on that host are two different problems, and the second one belongs to the transport layer.
How it works
What the transport layer does
The transport layer provides services to the application layer above it, and receives services from the network layer below it. The lecture calls it the heart of the TCP/IP protocol suite: it provides logical communication between applications or processes running on different hosts, at the port-number level.
A useful way to see the hierarchy: process-to-process communication rides on top of host-to-host delivery, which in turn rides on top of node-to-node delivery repeated across every link in the path. The transport layer is where “process-to-process” lives; everything below it only ever sees “host-to-host” or “node-to-node.”
How it works
Host and port addressing
A host may run multiple processes or applications at once, so identifying a conversation between two hosts needs two pieces of addressing on each side:
- Local host and remote host — identified by IP address.
- Local process and remote process — identified by port number.
A port number is a 16-bit integer between 0 and 65535. A client’s port is usually ephemeral — picked for one connection and short-lived. A server’s port is usually well-known — fixed, so clients always know where to connect. Both the source and the destination carry a port number in every segment.
| Port | Service |
|---|---|
| 20 | FTP data transfer |
| 21 | FTP control |
| 23 | Telnet |
| 25 | SMTP |
| 53 | DNS |
| 80 | HTTP |
How it works
IP address vs. port number
IP addresses identify hosts at the network layer. Port numbers identify processes at the transport layer. A segment’s journey down the stack looks like: application data, handed to the transport layer (TCP), placed inside a host’s outgoing traffic, then handed to the network layer (IP) for delivery. Each layer adds exactly the addressing it is responsible for — IP does not know about ports, and the transport layer does not re-decide which host to reach.
How it works
Socket address
A socket address is the combination of an IP address and a port number. It uniquely defines a client or server process. To actually use a transport-layer service, both a client socket address and a server socket address are needed — one alone only names one side of the conversation.
The lecture’s example: two different clients, host A and host C, both connect to the same web server, host B, on port 80.
| Source IP | Dest IP | Source port | Dest port | |
|---|---|---|---|---|
| Client A → server B | A | B | x | 80 |
| Client C → server B | C | B | y | 80 |
| Server B → client A | B | A | 80 | x |
| Server B → client C | B | C | 80 | y |
In the exam
- Port number range and width: 16 bits, 0 to 65535.
- Know the six well-known ports by name: 20 (FTP data), 21 (FTP control), 23 (Telnet), 25 (SMTP), 53 (DNS), 80 (HTTP).
- Socket address = IP address + port number. A question asking “what uniquely identifies a process” wants both, not just the IP address.
- A transport-layer service needs a pair of socket addresses, one for each end of the conversation — this is what the two-client example is testing.
Check yourself
- The transport layer provides process-to-process communication; the network layer only gets a datagram to the right host.
- A port number is 16 bits; clients typically use ephemeral ports, servers use well-known ports.
- IP addresses identify hosts at the network layer; port numbers identify processes at the transport layer.
- A socket address pairs an IP address with a port number, and both a client and a server socket address are needed to use a transport-layer service.