Networking

Client-Server vs. P2P

Every protocol in this domain — HTTP, MQTT, DNS — assumes one side asks and the other answers. That's a design choice, not a law of networking: this page is about the two fundamental shapes an application's communication can take, and why nearly everything covered so far picked one of them.

Quick reference
What it is
Two opposite architectures for how devices on a network talk to each other — one central authority everyone connects to, or every device talking directly to every other device.
Mental model
Client-server is a restaurant kitchen — one place everyone's order goes through. P2P is a potluck — everyone brings something and shares directly with everyone else, no central kitchen at all.
Key numbers
Client-server scales predictably by adding server capacity; P2P scales its raw capacity automatically as more peers join, at the cost of coordination complexity.
Reach for it when
Deciding whether a system needs one authoritative source of truth (client-server) or can tolerate — or wants — fully decentralized coordination (P2P).

Client-server

One or a small number of servers hold the data and make the decisions; every client talks only to a server, never directly to each other. Nearly every protocol on this domain — HTTP, DNS, SMTP — is built around exactly this shape, because it gives one obvious place to enforce rules, keep data consistent, and control access.

Client-server: every client connects only to the central server, never to each other Server Client Client Client Client
One authority, one place to enforce rules and keep data consistent — and one bottleneck/single point of failure.

Peer-to-peer

No central server at all — every participant (peer) can connect directly to others and exchange data with them, with the responsibility for coordination spread across the peers themselves rather than concentrated in one place.

Peer-to-peer: every peer connects directly to several others, with no central server at all Peer Peer Peer Peer Peer
No single bottleneck and no single point of failure — but also no one place enforcing consistency, which every peer now has to handle cooperatively.

The real tradeoff

Client-serverPeer-to-peer
Consistency/controlEasy — one authority decidesHard — peers must agree cooperatively
Single point of failureYes — the serverNo — inherently redundant
Scaling raw capacityRequires adding server capacityGrows automatically as peers join
SimplicitySimple to reason about and secureGenuinely harder to design correctly

Real-world applications

Gotchas

Field notes