Lesson 4 of 8
Packets, TCP & UDP
How data is chopped into packets, and why some traffic needs TCP's reliability while other traffic prefers UDP's speed. Practical: deliver a file as packets.
Learn it
Networks don't send whole files in one go. Data is chopped into packets — small chunks, each with a header saying where it is from, where it is going and which piece of the whole it is.
Packets can travel different routes and arrive out of order; the receiving device reassembles them. This is packet switching, and it lets millions of devices share the same links.
TCP is the careful protocol: it opens a connection, numbers every packet, resends anything lost and delivers data in order. Web pages, email and file downloads use TCP.
UDP is the fast protocol: it just fires packets with no connection and no resending. Live video calls, online games and DNS queries use UDP, where a late packet is useless anyway.
Practical · 25–30 minutes
Deliver a file as packets
Paper, scissors and a partner; optionally browser Developer Tools on your own requests.
Only inspect your own device or teacher-approved equipment and targets. Never change the school network, disconnect shared cables, scan other devices or record passwords. If tools are blocked, use the supplied examples or browser lab.
Key terms
- Packet
- A small chunk of data with a header, sent across a network.
- Packet switching
- Splitting data into packets that may take different routes and are reassembled at the destination.
- TCP
- A connection-based protocol that delivers data reliably and in order.
- UDP
- A fast, connectionless protocol with no guarantee of delivery or order.
- Port
- A number identifying which program on a device should receive data.
- Three-way handshake
- TCP's SYN, SYN-ACK, ACK exchange that opens a connection.
TCP or UDP?
- 1Sort: Make two columns labelled TCP and UDP. Sort these into them: loading a web page, a live video call, sending an email, an online game, a DNS lookup, downloading a file.
- 2Justify: For each one, write one phrase: does it need every piece to arrive, or does it need speed more?
- 3Port hunt: Match the ports: which of 80, 443 and 53 belongs to HTTPS, which to HTTP, which to DNS?
The three-way handshake
textCLIENT SERVER
|------- SYN -------------->| "Can we talk?"
|<------ SYN-ACK -----------| "Yes — can you?"
|------- ACK -------------->| "Yes — let's begin."
|======= data, numbered ===>| each packet acknowledged
|------- FIN -------------->| "Done — closing."Before any data moves, TCP makes sure both sides are ready. Every data packet is then numbered and acknowledged, so losses are detected and repaired.
Try it
Match each job to the protocol that suits it best.
Challenge
A classmate says: 'We should make video calls use TCP so no data is ever lost.' Explain why that would actually make calls worse, using the ideas of resending, latency and what a viewer does with a late video frame. Then name one situation where TCP's reliability is absolutely worth the extra time.
Pick whichever way suits you — every mode earns the same bonus XP.
Write at least 40 more characters to submit.
Mark your own work
Guided walkthrough — 0/2 clues revealed
- Clue 1 locked — reveal it only if you get stuck.
- Clue 2 locked — reveal it only if you get stuck.
Each clue costs 3 XP (never below 13 XP). You'd earn 25 XP right now.