Transport Layer·Lesson 2 of 9

Process-to-Process Communication

01

Two Kinds of Delivery

Getting data across a network happens in two steps, handled by two different layers. The delivers data host-to-host: it uses an to get a packet to the right computer. But your computer is running many programs at once — a browser, a chat app, a music player — and they may all want network data at the same time. Reaching the computer isn't enough; the data has to reach the right program. That final step, program-to-program, is called process-to-process communication, and it's the transport layer's job.

Host-to-host vs process-to-process

Host-to-host delivery finds the right computer (network layer, using IP). Process-to-process delivery finds the right program on that computer (transport layer, using port numbers).

🏬

The apartment building

A street address gets a letter to the right building — but the building has dozens of apartments. Without an apartment number, the mail carrier is stuck in the lobby. The IP address is the street address (it finds the building); the apartment number is what gets the letter to the right resident. In networking, that apartment number is the port.

02

What Is a Process?

A is simply a running program. When you open your web browser, the operating system starts a process for it; your email client is another process; a background updater is yet another. Each is a separate resident in the building, and each may be sending or waiting for its own network data at the same moment. The transport layer's task is to keep all these conversations straight so each program gets exactly its own data and nobody else's.

03

How the Right Process Is Found

The transport layer tags every chunk of data with two numbers: one for the sending program and one for the receiving program. A port number is just a label that identifies a specific process on a machine. When data arrives, the computer reads the destination port and hands the data to whichever program is using it. The IP address got the data to the machine; the port number finishes the trip to the program.

Put the two layers side by side and the division of labour is clear:

Host-to-hostProcess-to-process
Handled byNetwork layerTransport layer
Address usedIP addressPort number
Delivers toThe right computerThe right program
AnswersWhich machine?Which app on it?
Example142.250.72.14Port 443 (HTTPS)
04

A Concrete Example

1

You have a web browser and a music streaming app open at the same time. Both are receiving data from the internet, and it all arrives at your computer's single IP address.

How does the web page end up in the browser and the song end up in the music app, instead of getting mixed up?

Answer: Each program is using a different port number. The web data is addressed to the browser's port and the music to the music app's port. When packets arrive at your computer, the transport layer reads each one's destination port and delivers it to the matching program. The shared IP address gets everything to your machine; the port numbers sort it to the correct app.

🚫

"An IP address is enough to deliver data to an application."

An IP address only identifies the computer. Since one computer runs many programs at once, the transport layer also needs a port number to know which program the data belongs to. IP finds the machine; the port finds the app.

Q:Why isn't an IP address enough to deliver data to the correct application?

A: Because a single computer runs many programs that all share the same IP address. The IP address gets the data to the machine, but it can't say whether a given packet is for the browser, the email client, or a game. The transport layer adds a port number that identifies the specific program, so the data can be delivered process-to-process rather than just host-to-host.

Quick Revision Cheat Sheet

Host-to-host: Network layer delivers to the right computer (IP)

Process-to-process: Transport layer delivers to the right program (port)

Process: A running program, e.g. your browser or chat app

Why ports: One computer runs many programs on one IP address

Rule of thumb: IP finds the machine; the port finds the app