Books indexNetwork Foundations: from mental models to data measurement

Lesson

Lesson 6: Client-server and peer-to-peer models

Lesson 6 of 24 · Module 2: Data representation and performance

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

  1. A browser creates an HTTP request and acts as the client.
  2. The web server interprets the request and returns a result or error response.
  3. In peer-to-peer exchange, a device may request one file piece and later provide another.
  4. 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.

Client-server request and response

A client sends a request and a server returns a response; the names are interaction roles.

Client-server request and responseA client sends a request and a server returns a response; the names are interaction roles.Data flowData flowData flowData flowClientrequests a serviceRequestapplication intentServerprocesses requestResponseresult or statusClient-server request and responseA client sends a request and a server returns a response; the names are interaction roles.Clientrequests a serviceRequestapplication intentServerprocesses requestResponseresult or status
Source or destinationDirection or relationTeaching simplification
A teaching request-response pattern, not the only communication shape.

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.

Changing roles in peer-to-peer

Three peers request and provide resources while an optional discovery service can assist.

Changing roles in peer-to-peerThree peers request and provide resources while an optional discovery service can assist.Data flowData flowData flowContextual relationContextual relationContextual relationPeer Arequestsand providesPeer Brequestsand providesPeer Crequestsand providesDiscovery serviceoptional supportChanging roles in peer-to-peerThree peers request and provide resources while an optional discovery service can assist.Peer Arequests and providesPeer Brequests and providesPeer Crequests and providesDiscovery serviceoptional support
Source or destinationDirection or relationTeaching simplification
Peers exchange roles; support servers and intermediaries may remain.

Common misconception

Application interaction models compared
ModelRole distributionStrengthConstraintExample
Client-serverClient requests; server respondsClear central administrationDependence on the central serviceBrowser and web server
Peer-to-peerEach peer may request and provideDistributed resourcesHarder discovery and trustFile-piece exchange
HybridPeer exchange with supporting servicesCoordination plus distributed transferA central component still mattersDiscovery 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

  1. Can one program act as both client and server?
  2. Why does request-response not cover every client-server pattern?
  3. Does peer-to-peer mean packets avoid routers?
Show the explained answers
  1. Yes. The role belongs to an interaction: a program can request a service in one exchange and provide one in another.
  2. Some services use streams, server push or multiple interleaved messages rather than one request followed by one response.
  3. No. Peer-to-peer describes endpoint roles; packets may still cross switches, routers and other intermediaries.

References and evidence limits