← WA Computer Science ATAR Unit 1

Peer-to-peer and client-server communication models

How devices share the work of requesting and providing data: client-server uses dedicated servers, while peer-to-peer lets every device do both.

Understanding Peer-to-peer and client-server communication models in WA Computer Science ATAR Unit 1

What it does: Centralising data and management on a dedicated server is the client-server model, which makes administration and security easier to control. Peer-to-peer spreads storage and sharing across devices. If one peer fails the others keep working, but there is no central point to enforce security. In peer-to-peer, each device (peer) can act as both client and server. In peer-to-peer (P2P) every device is a peer that shares and requests data, so the work is distributed across the network.

Common mistakes: The loop must go through the list of clients, because every client sends a request to the single server. A server is one device, not a list to loop over. It should be: FOR EACH c IN clients DO. Peer-to-peer has no dedicated server. Each peer requests data from another peer, so the line should be p.request(random(peers)).

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 315–470) and word search (Modules 100–470).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
In a client-server model, which device is dedicated to providing data and services to other devices?
The serverEvery device equally
Matches
A peer-to-peer network needs a dedicated server to share files between devices
↓
Peer-to-peer does not need a dedicated server. Each device acts as both client and server and shares directly with other peers.
Applying
Meanings
Term
communication model
Meaning
How devices share the work of requesting and providing data: client-server uses dedicated servers, while peer-to-peer lets every device do both.
Practice
model <- "client-server"
Testing
Gaps
.request("page.html", webServer)
Check Answer
Spots
3clients ← ["Ava", "Liam"]
4FOR EACH c IN server DO

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Giant Isopod' badge — Patient Builder, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. In a client-server model, which device is dedicated to providing data and services to other devices?
A. Every device equally
B. The server ✓
A client-server network uses dedicated servers to provide resources. Clients mainly request them.
2. Which communication model lets every device both request and provide data?
A. Client-server
B. Peer-to-peer ✓
In peer-to-peer, each device (peer) can act as both client and server.
3. A school stores all student files on one central machine that students log in to. Which model is this?
A. Client-server ✓
B. Peer-to-peer
One central, dedicated machine providing files to many users is client-server. It is centralised.
4. Which statement describes a peer-to-peer network?
A. Data and management are distributed across the devices ✓
B. All data is controlled from one central server
Peer-to-peer is distributed. Client-server is centralised, with one place to manage data.
5. Which model is usually cheaper to set up for a small home network because it needs no dedicated server?
A. Peer-to-peer ✓
B. Client-server
Peer-to-peer avoids the cost of server hardware and a network administrator. Client-server costs more to set up.

Match the Pairs

client-server → A communication model where dedicated servers provide data and services, and client devices request them
peer-to-peer → A communication model where every device can both request and provide data, with no dedicated server
Centralised model: one dedicated server stores the files and manages user accounts, so it is easier to manage and back up → model = "client-server"
Distributed model: each device shares its own files directly with others, so there is no single point of failure but security is harder to control → model = "peer-to-peer"
A peer-to-peer network needs a dedicated server to share files between devices → Peer-to-peer does not need a dedicated server. Each device acts as both client and server and shares directly with other peers.
If the web server in a client-server network fails, the other clients keep providing the web pages → Clients do not provide the web pages, the server does. If the single server fails, the service is lost, which is a reliability weakness of client-server.

Key Term

communication model
How devices share the work of requesting and providing data: client-server uses dedicated servers, while peer-to-peer lets every device do both.

Fill in the Blanks

1. client.request("page.html", webServer)
Hint: Type the role of the device that asks a dedicated server for data.
2. peer.canRequest ← TRUE peer.canProvide ← TRUE
Hint: Type the Boolean value showing that in peer-to-peer each device can also provide data.
3. IF model = "client-server" THEN store(files, server) ELSE store(files, allPeers)
Hint: Type the dedicated machine that holds the shared files in the centralised model.
4. IF server.online = FALSE THEN clients.canAccess ← FALSE
Hint: Type the Boolean value showing what happens to client access when the central server fails.
5. FOR EACH peer IN network peer.share("notes.pdf")
Hint: Type the variable name for each device in the peer-to-peer network.

Spot the Error

Question 1
A model ← "client-server"
B server ← "WebServer"
C clients ← ["Ava", "Liam"]
D FOR EACH c IN server DO
E c.request(server)
Line D — The loop must go through the list of clients, because every client sends a request to the single server. A server is one device, not a list to loop over. It should be: FOR EACH c IN clients DO.
Question 2
A peers ← ["PC1","PC2","PC3"]
B FOR EACH p IN peers DO
C p.share("song.mp3")
D p.request(server)
E END FOR
Line D — Peer-to-peer has no dedicated server. Each peer requests data from another peer, so the line should be p.request(random(peers)).
Question 3
A model ← "peer-to-peer"
B hasServer ← TRUE
C IF hasServer = FALSE THEN
D OUTPUT "Peers only"
E ENDIF
Line B — A peer-to-peer network has no dedicated server, so every device is equal. hasServer should be FALSE, otherwise the IF check and the output would not match the model.
Question 4
A serverCount ← 0
B IF serverCount > 0 THEN
C OUTPUT "client-server"
D ENDIF
Line A — The client-server model needs at least one dedicated server. With serverCount set to 0 the condition is false and the client-server message never prints. It should be serverCount ← 1.
Question 5
A peerA.request("report.docx")
B peerB.receive_request()
C server.send("report.docx")
D peerA.save("report.docx")
Line C — In peer-to-peer file sharing, the peer that holds the file sends it directly to the requesting peer. There is no dedicated server in this model. The line should be peerB.send("report.docx").

Student with a class code? Join your class →