Packet.School
HomeLevelsSandboxPricingAbout
XP1,240
L3 · Protocols
Level 3
5 lessons
  • 01HTTP/HTTPS
  • 02How DNS Works?
  • 03DHCP
  • 04TCP vs UDP
  • 05Level 3 Quiz
Levels/L3 · Protocols/Lesson 04
Simulation · 04

TCP vs UDP

The two main protocols of the Transport layer: TCP and UDP.

Duration
2min
Level
L3
Type
Simulation
Progress
4/ 5

01Basic Differences

FeatureTCPUDP
ConnectionConnection-basedConnectionless
Reliability100% guaranteedNo guarantee
OrderingOrdered deliveryUnordered
SpeedSlowFast
OverheadHighLow

02TCP - Like a Phone Call

TCP = Reliable

Features:

  • 3-Way Handshake: Connection setup
  • Sequence Numbers: Ordering guarantee
  • Acknowledgments: Each packet confirmed
  • Retransmission: Lost packets resent
  • Flow Control: Speed control

TCP Connection Setup:

code
Client         Server
  |--- SYN --->|
  |<-- SYN+ACK-|
  |--- ACK --->|
  [Connection OK]

TCP Data Transmission:

code
Data 1 →→→ ACK 1
Data 2 →→→ ACK 2
Data 3 →→→ LOST!
Data 3 →→→ ACK 3 (Resend)

03UDP - Like a Letter

UDP = Best Effort

Features:

  • Connectionless: No handshake
  • Fast: Low overhead
  • Simple: Just send
  • May be lost: No guarantee

UDP Transmission:

code
Data 1 →→→ ✓
Data 2 →→→ ✓
Data 3 →→→ ✗ (Lost, no retry)
Data 4 →→→ ✓

04When to Use Which?

Use TCP:

  • 🌐 Websites (HTTP/HTTPS)
  • 📧 Email (SMTP, IMAP)
  • 📁 File transfer (FTP)
  • 🔐 SSH connections

Use UDP:

  • 🎮 Online games
  • 📹 Video streaming
  • 📞 VoIP (Voice calls)
  • 🔍 DNS queries
  • 📡 DHCP

05Game Example

In online gaming:

  • Character position: UDP (speed matters, loss is OK)
  • Purchase transaction: TCP (must arrive)

06Summary

  • TCP = Reliable but slow (web, email)
  • UDP = Fast but unreliable (games, video)
  • Choose the right protocol for your needs!
Previous
DHCP
Next
Level 3 Quiz
On this page
  • Basic Differences
  • TCP - Like a Phone Call
  • UDP - Like a Letter
  • When to Use Which?
  • Game Example
  • Summary
Packet.School

An open, interactive curriculum for computer networking.

v3.0 · MIT22 lessons live

Learn

  • Lessons
  • Sandbox
  • Levels
  • Pricing
  • About

Simulations

  • Packet Journey
  • DNS Lookup
  • DHCP Simulator
  • Subnet Calc
  • Network Builder
  • Terminal

Project

  • About
  • Changelog
  • GitHub
  • Contributing
  • Style guide

Newsletter

One short email when a new level ships. No tracking pixels.

© 2026 Packet.School — MIT licensed☕ Support with a coffeebuilt in the open · last updated 2026.05.14