ELEC3506

Topics

Transport LayerLecture 7 PDF15 min

Transport layer services and addressing

What the transport layer adds on top of the network layer, and how a port number and an IP address combine into a socket address that names one process on one host.

By the end of this page you should be able to

  • State what the transport layer provides to the application layer and what it receives from the network layer
  • Distinguish an ephemeral client port from a well-known server port
  • Name at least four well-known port numbers and the service each one identifies
  • Construct the socket address pair a client and server need to use a transport-layer service

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.

PortService
20FTP data transfer
21FTP control
23Telnet
25SMTP
53DNS
80HTTP
The well-known port numbers Lecture 7 lists directly.

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 IPDest IPSource portDest port
Client A → server BABx80
Client C → server BCBy80
Server B → client ABA80x
Server B → client CBC80y
Server B's own socket address (B, port 80) never changes. What tells the two connections apart is each client's own IP address and its own ephemeral source port, x and 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.

Check yourself

  1. A host is running a web server and a mail server at the same time. What lets an arriving segment reach the right one?
  2. Which of these port numbers is a well-known port, not an ephemeral one?
  3. Two different client hosts, A and C, each open a connection to the same web server B on port 80. How does B tell the two connections apart?
  4. What does the transport layer receive from the layer below it?