sciandu
Computer science

Computer science

Client & server

Your device asks, a computer somewhere in the world answers: that is how almost everything on the internet works.

What you need first

You tap on a video and it starts. You send a message and it arrives. Behind all of it is the same pattern: your device asks a question, and somewhere another computer answers. Like ordering in a restaurant: you say what you want, the kitchen delivers. This pattern is called client and server, and it carries practically the whole internet.

Who asks, who answers?

Client and server are roles, not fixed devices. The client role is the program that wants something: on your phone, laptop or game console. The server role is a program that waits to be asked and then delivers: a web page, a video, your messages. The names give it away: a client is a customer, a server is the one that serves. The client always starts the conversation with a request, and the server sends back a response. The same computer can actually be both, sometimes a client and sometimes a server. The server often fetches those answers from a , just like the ones you already know.

Packet router
YouServerAB

The message is split into small packets that travel on their own.

Message = 3 packets, route via A

Try it: send a request on its journey and follow how it travels to the server and back, split into small packets.

Request and response travel as packets

Requests and responses are not sent in one piece. They are split into small packets that travel through the network individually, even along different routes. The protocol TCP takes care of this: it reassembles the packets in the right order at the receiver. If a packet gets lost on the way, only that one packet is sent again, not the whole response.

Many clients, one server

A server never serves only you. Thousands of clients send it requests at the same time, and it handles many of them in parallel. If more requests arrive than it can manage, it slows down: requests pile up, everyone waits longer, and some fail. That is exactly what happens when a website collapses during a big ticket sale. Large services therefore spread the load across many servers.

Exercises

0 of 6 solved

Time to try it yourself. You can't break anything, every attempt counts.

You open a web page on your phone. What role does your phone play?

What does a server do most of the time?

Your request is split into 4 packets, the server's response into 6 packets. How many packets travel through the network in total?

Put the steps of a request on the internet in the right order.

  1. 1The request travels through the network in small packets.
  2. 2The server receives the request and looks up the answer.
  3. 3The client sends off a request.
  4. 4The server sends the response back to the client.

A server answers 20 requests per second. How many requests does it handle in 5 seconds?

Match each term to its job.

Client
Server
TCP

Where this leads