Networking Basics · 3

📦 TCP vs UDP

Two ways to send data — pick the right one⏱ ~2 min

📮Certified mail vs. dropping leaflets

TCP is like certified/registered mail — you send it, the post office tracks it, and you get a confirmation when it's delivered. If it gets lost, it's resent. UDP is like dropping thousands of flyers from a helicopter — fast, covers everything, but you don't know exactly who got one. Different jobs need different approaches.

TCP
  • ✅ Guaranteed delivery
  • ✅ Packets arrive in order
  • ✅ Error checking & retransmission
  • ✅ Flow control
  • 📧 Email, web browsing, file downloads, SSH
  • 🐌 Slightly slower due to handshaking
UDP
  • ⚡ No delivery guarantee
  • ⚡ No ordering
  • ⚡ No retransmission
  • ⚡ No connection setup
  • 🎮 Gaming, video calls, live streams, DNS
  • 🚀 Much faster — fire and forget

The TCP 3-Way Handshake

  1. 1.SYN — Your computer says: 'Hey server, can we talk?'
  2. 2.SYN-ACK — Server replies: 'Sure! I'm ready.'
  3. 3.ACK — Your computer confirms: 'Great, let's go!'

Only after these 3 steps does real data start flowing. This is why TCP is slower to start but much more reliable.

★ FactWhen you're on a video call (Zoom, FaceTime), UDP is used intentionally. A tiny dropped frame looks like a brief glitch — but if TCP kept pausing to retransmit it, your whole call would freeze and stutter. A little imperfection is better than a lag spike.
🔒 SecuritySYN Flood Attack: Hackers exploit the TCP handshake by sending millions of SYN requests but never completing the ACK step. The server holds thousands of half-open connections in memory until it crashes. This is one of the most common DDoS techniques.
🧠Quick Checkfirst try = +5 XP

You're building a live streaming app. Which protocol should you use for the video feed?

0 XP🔥 0 days