Computer Networks · Transport Layer
Role of Port Numbers in Reaching Processes
Overview
Delivering data to the right application on a destination host requires three levels of addressing: resolving a domain name to an IP address, using the IP address to reach the host, and using a port number to reach the specific process on that host.
Port numbers make process-to-process delivery possible, and well-known services use fixed, globally known port numbers.
Key concepts
- Three levels of addressing: data delivery needs (1) domain name → IP address (name resolution), (2) IP address → host (via its two parts, Network ID and Host ID), and (3) port number → process (the specific application/service on that host).
- Port number: the address of the process. For well-known services it is predefined and fixed, and globally known.
- Network ID: the part of the IP address used to reach the target network.
- Host ID: the part of the IP address used to reach the target host within that network.
- Well-known service: a service whose port number is predefined, so everyone knows it in advance — for example, all web services (HTTP) run at port 80, which is globally known.
- Non-well-known service: a service without a predefined port; the specific port number at which the target server is running must be known explicitly.
How it works
- Convert the domain name into an IP address.
- Use the Network ID of the IP address to reach the network.
- Use the Host ID to reach the host.
- Use the port number to reach the process.
Reaching the host is not enough — the data must reach the correct process on that host, which is why the port number is required.
Formulas
- Network ID reaches the target network; Host ID reaches the target host within it.
Worked examples
Well-known port numbers:
- HTTP (web service) → port 80
- FTP → port 21
- SMTP → port 25
Comparison
| Addressing level | Field used | What it identifies |
|---|---|---|
| Network | Network ID (part of IP address) | Target network |
| Host | Host ID (part of IP address) | Target host |
| Process | Port number | Target process/application |
| Service type | Port number | Do you need to know it in advance? |
|---|---|---|
| Well-known service (e.g., HTTP, FTP, SMTP) | Predefined and fixed (80, 21, 25) | No — globally known |
| Non-well-known service | Chosen by the server | Yes — must know the port the server is running on |
Revision summary
- IP address = Network ID + Host ID; Network ID reaches the network, Host ID reaches the host.
- A port number is required to reach the process on the host — reaching the host alone is not enough.
- Well-known services have predefined, fixed, globally known port numbers.
- Memorise: HTTP = 80, FTP = 21, SMTP = 25.
- For non-well-known services, the port number must be known explicitly.
- Full delivery chain: domain name → IP address → network (Network ID) → host (Host ID) → process (port number).
Previous-year exam insights
- Port numbers are 16-bit unsigned integers, so the valid range is 0–65535.
They are divided into well-known ports (0–1023), registered ports (1024–49151) and dynamic/ephemeral ports (49152–65535). - A connection is uniquely identified by the socket pair (source IP, source port, destination IP, destination port); the same server port can serve many clients simultaneously because the client's IP/port differ.
- Standard well-known ports to memorise: HTTP 80, HTTPS 443, FTP control 21 (data 20), SSH 22, Telnet 23, SMTP 25, DNS 53 (UDP for queries, TCP for zone transfer), DHCP server 67 / client 68, TFTP 69, POP3 110, IMAP 143, SNMP 161, BGP 179.
- Ports are used by both TCP and UDP; the port number space is separate per protocol, so TCP port 53 and UDP port 53 are distinct.
- The transport-layer header carries the source and destination port numbers (plus sequence/acknowledgement numbers in TCP, or length/checksum in UDP); IP header carries only the IP addresses, so the port is what enables demultiplexing at the receiver.
- A server uses a fixed well-known port for listening, while the client uses an ephemeral port assigned by the OS; the server replies to that client port, so the client need not know its own port in advance.