Course outline · 0% complete

0/27 lessons0%

Course overview →

Clients and servers

lesson 7-1 · ~9 min · 22/27

Quiz

Warm-up from unit 6: a program's variables live in RAM while it runs. What happens to them when the program ends or the power goes off?

Two computers talking

So far everything ran on one machine. The internet is what happens when programs on different machines send each other data.

The pattern behind nearly all of it is client and server:

  • A client is the program that asks: your browser, your phone apps
  • A server is a program (running on a computer that is usually in a data center, a warehouse-sized building full of computers run around the clock exactly for this) that answers: it waits, receives requests, and sends back responses

When you visit a website, your browser sends a request across the internet, something like "GET the page at hackuniversity.dev". The server receives it, runs code to build or fetch the page, and sends back a response containing the page data. Your browser then draws it.

It is lesson 1-1's triangle stretched across the planet: the request is the server's input, its code is the process, and the response is its output. A server is just a program, and people write servers in Python every day.

client(browser)server(data center)request →← responseone round trip, usually well under a second
A request travels from client to server, the server's code runs, and a response travels back. Every page load is at least one of these round trips.

Quiz

You open a weather app and today's forecast appears. Which statement fits the client-server model?

Problem

In the client-server model, what is the general name for the program that waits for requests and sends back responses?