TCP vs UDP
Lesson 18 of 32 in Coddy's The OSI Model course.
Layer 4 offers two services. TCP: connection, ordering, retransmission of anything lost; you pay for the guarantee with latency. UDP: fire single datagrams and hope; nothing is guaranteed, nothing is waited for.
The choice follows one question: is a late packet still useful? A file download must be complete, so TCP. A frame of a video call that arrives late is garbage, better to drop it and show the next one, so UDP. DNS queries are tiny one-shot questions where a retry is cheaper than a connection, so UDP.
Challenge
BeginnerPick the right protocol for each job. Print one per line, uppercase, in this order:
- A live video call
- Downloading a zip file
- A DNS lookup
Expected output:
UDP
TCP
UDPTry it yourself
All lessons in The OSI Model
Practice on your own: Terminal playground