Lesson
Lesson 6: Client-server and peer-to-peer models
Learning goal
After this lesson, you can describe client and server roles in a defined interaction and separate application organisation from the physical data path.
Why this concept matters
Client, server and peer describe a program’s role in an interaction, not a permanent device type. This explains web, file sharing and hybrid systems without forcing a wholly centralised or decentralised story.
Trace a web request, then a peer exchange
- A browser creates an HTTP request and acts as the client.
- The web server interprets the request and returns a result or error response.
- In peer-to-peer exchange, a device may request one file piece and later provide another.
- A discovery or identity service may remain; P2P does not remove servers or network intermediaries automatically.
Client and server are roles
A client requests a service in an interaction; a server accepts and processes the request and provides a response or service. The labels do not specify machine size or power. A server can call another service and act as its client.
HTTP is a familiar application-layer request-response protocol, but not every client-server exchange has that shape; streams, notifications and long-lived connections also exist.
A client sends a request and a server returns a response; the names are interaction roles.
Peer-to-peer architecture
Peers can provide and consume resources and may alternate client and server roles. Their capabilities need not be identical, and a discovery, coordination or relay server may still support the system.
Peer-to-peer also does not mean a direct physical cable. Traffic can traverse access points, switches, routers and provider networks. The term describes application roles and resource distribution.
Synchronisation example
Three computers may contact a discovery service to find authorised peers and then exchange file pieces. Each device is a client while requesting and a server while providing. A relay may be needed when a direct connection fails.
Three peers request and provide resources while an optional discovery service can assist.
Common misconception
| Model | Role distribution | Strength | Constraint | Example |
|---|---|---|---|---|
| Client-server | Client requests; server responds | Clear central administration | Dependence on the central service | Browser and web server |
| Peer-to-peer | Each peer may request and provide | Distributed resources | Harder discovery and trust | File-piece exchange |
| Hybrid | Peer exchange with supporting services | Coordination plus distributed transfer | A central component still matters | Discovery index and direct transfer |
Diagnostic exercise
Takeaway and the next lesson
Roles follow interactions: one system can be client now and server or peer later. The next lesson examines the protocols, standards and services that organise those interactions.
Quick review
- Can one program act as both client and server?
- Why does request-response not cover every client-server pattern?
- Does peer-to-peer mean packets avoid routers?
Show the explained answers
- Yes. The role belongs to an interaction: a program can request a service in one exchange and provide one in another.
- Some services use streams, server push or multiple interleaved messages rather than one request followed by one response.
- No. Peer-to-peer describes endpoint roles; packets may still cross switches, routers and other intermediaries.

