Menu
Coddy logo textTech

Watching the Layers

Lesson 23 of 32 in Coddy's The OSI Model course.

You can watch the layers cooperate with one command. When curl fetches a URL, it resolves the name (DNS), opens a TCP connection to the port (layer 4), and only then speaks HTTP (layer 7). With -v you literally see each stage narrated.

The layer 7 result is the status code: the server's three-digit answer. 200 means success. curl can print just that code with -o /dev/null -w "%{http_code}\n", throwing the page body away.

Time to run a whole stack, top to bottom, on your own machine.

challenge icon

Challenge

Medium

Run a full protocol stack locally:

  1. Start a server on port 9220 in the background and wait for it
  2. Fetch http://127.0.0.1:9220/ with curl -s, discarding the body, and print only the HTTP status code

Expected output:

200

Try it yourself

Terminal

All lessons in The OSI Model

Practice on your own: Terminal playground