TCP vs UDP: the two postmen of the internet

☰ All 15 lessons

When you send an email, a file or make a video call, there's a postman carrying your data to the other side. That postman is TCP or UDP.

Why TCP and UDP exist

To send mail between computers there's a protocol called SMTP. For transferring files there's FTP. There are lots of protocols like these, and they all need one common thing: getting data from one device to another.

So that nobody has to write that delivery code again and again, TCP and UDP were built. The people who built SMTP only had to prepare the mail the way mail should look; the job of getting it to the other side is handed to TCP. FTP works the same way.

TCP resends a lost packet, UDP does notTCP12345TCP: "Did 3 arrive?" · resends 3 ✓UDP12345UDP: sends 1, 2, 3, 4, 5 and never checks
Packet 3 gets lost on both. TCP notices and sends it again; UDP carries on.

The difference

TCP sends the data and then asks: did it arrive properly? If something didn't, it sends it again. That makes TCP reliable, but all that checking and resending makes it a bit slower.

UDP doesn't do any of that. It sends the data, and whether it arrived is not its problem. It never looks back. That makes UDP fast.

TCPUDP
Checks delivery?Yes, and resends lost dataNo
SpeedSlowerFaster
Sets up a connection first?Yes, the 3-way handshake (next lesson)No
Used forWebsites, email (SMTP), file transfer (FTP), SSHVideo calls, online games, live streams, DNS lookups

Which one, when?

In a video call, if one or two frames get lost, there's no point sending them again: that moment has passed. Speed matters more, so UDP fits. When you send an email, you need to be sure every part arrived. There, TCP is the safer choice.

For hackers: scanners treat the two differently. A TCP port answers clearly whether it's open; a UDP port often stays silent, which is why UDP scans are slower and less certain.

Key takeaways

  • TCP and UDP are the "postmen" other protocols hand their data to.
  • TCP checks delivery and resends lost data: reliable, slower.
  • UDP sends without checking: fast, no guarantee.
  • Email, websites and files use TCP; video calls and games use UDP.

Quick quiz

Pick an answer to check yourself. Answer both to mark this lesson done.

1. Who do protocols like SMTP and FTP hand the job of delivering data to?

  1. A) MAC address
  2. B) TCP / UDP
  3. C) Modem
  4. D) Wi-Fi password
Show answer

Answer: B. SMTP and FTP prepare the data; the postman's job of delivering it is done by TCP and UDP.

2. Why is UDP good for video calls?

  1. A) It's more secure
  2. B) It checks every packet arrived
  3. C) It's fast, and a lost frame or two doesn't need resending
  4. D) It was built for email
Show answer

Answer: C. In a video call speed matters. UDP sends without checking, and losing a frame or two is fine.

Frequently asked questions

What is the main difference between TCP and UDP?

TCP checks that data arrived and resends what was lost, so it is reliable but slower. UDP sends without checking, so it is faster but gives no guarantee.

Is DNS TCP or UDP?

Ordinary DNS lookups use UDP on port 53 because they are small and need to be fast. DNS switches to TCP for large responses.

Does email use TCP or UDP?

Email protocols like SMTP run on TCP, because every part of the message must arrive.

Do it hands-on.

This tutorial gives you the concepts. The 50 Days Ethical Hacking Challenge puts them to work in real labs, explained in Malayalam.