Skip to main content

Command Palette

Search for a command to run...

Understanding TCP vs UDP – Reliability vs Speed

Updated
3 min readView as Markdown

Over the last few days, I've learned how browsers find websites using DNS, how HTTP enables communication between clients and servers, and how HTTPS secures that communication.

Today, I went one layer deeper into networking and explored TCP and UDP—the two transport protocols that move data across the Internet.

Although we use the Internet every day, I realized I had never thought about how data actually travels from one computer to another.

Let's dive in.


What is TCP?

TCP (Transmission Control Protocol) is a communication protocol that ensures data is delivered accurately, completely, and in the correct order.

Before any data is exchanged, TCP establishes a connection between the client and the server.

This process is known as the Three-Way Handshake.

Client          Server

SYN  --------->

      <--------- SYN + ACK

ACK  --------->

Once the connection is established, data transfer begins.


Features of TCP

✔ Reliable communication

✔ Error checking

✔ Ordered delivery

✔ Retransmission of lost packets

✔ Flow control

Because of these features, TCP is the preferred choice whenever data accuracy matters.


Common Uses of TCP

TCP is commonly used for:

  • Web Browsing (HTTP & HTTPS)

  • Email (SMTP, IMAP, POP3)

  • File Transfer (FTP)

  • SSH

  • Database Connections

Whenever losing data is unacceptable, TCP is usually the right choice.


What is UDP?

UDP (User Datagram Protocol) takes a different approach.

Unlike TCP, UDP does not establish a connection before sending data.

It simply sends packets to the destination without waiting for acknowledgments.

This makes UDP much faster but less reliable.


Features of UDP

✔ Very fast

✔ Low latency

✔ No connection setup

✔ No guarantee of delivery

✔ No packet ordering

If a packet is lost, UDP does not resend it.


Common Uses of UDP

UDP is ideal for applications where speed is more important than perfect accuracy.

Examples include:

  • Online Gaming

  • Live Video Streaming

  • Voice Calls (VoIP)

  • Video Conferencing

  • DNS Queries

If a single packet is lost during a video call, you might notice a tiny glitch—but the conversation continues smoothly. Waiting for retransmissions would create noticeable delays, so UDP is a better fit.


TCP vs UDP

TCP UDP
Connection-oriented Connectionless
Reliable Best-effort delivery
Slower Faster
Error recovery No error recovery
Ordered delivery No ordering guarantee
Higher overhead Lower overhead

Which One Should You Use?

There isn't a "better" protocol—each is designed for different needs.

Use TCP when:

  • Accuracy is critical.

  • Every packet must arrive.

  • Data integrity matters.

Use UDP when:

  • Speed is the priority.

  • Small packet losses are acceptable.

  • Low latency is more important than reliability.


My Biggest Takeaway

Before today, I assumed all Internet communication worked the same way.

Now I understand that different applications have different priorities.

Banking transactions, emails, and websites rely on TCP because reliability is essential.

Online games, video calls, and live streaming often rely on UDP because speed matters more than receiving every single packet.

It's fascinating to see how the Internet balances reliability and performance depending on the situation.

Every layer I explore makes me appreciate how thoughtfully these protocols were designed.

1 views

100 Days of Code: My Journey to Becoming a Full Stack Developer

Part 8 of 50

Welcome to my 100 Days of Code journey! In this series, I'll document my daily progress as I learn Full Stack Web Development from the ground up. Every post will cover what I learned, challenges I faced, mistakes I made, and the projects I built. My goal is not just to complete 100 days but to become a better developer through consistency, discipline, and learning in public. Topics I'll cover include: • Git & GitHub • HTML, CSS & JavaScript • React.js • Node.js & Express • MongoDB • APIs • Real-world Projects • AI tools for Developers Whether you're just starting out or revising your fundamentals, I hope this journey helps you learn alongside me. Let's build, learn, and grow together! 🚀

Up next

What Happens When You Type google.com in Your Browser?

Over the past week, I've learned about computer networks, DNS, HTTP, HTTPS, cURL, and TCP/UDP. Today, I wanted to connect all of those concepts by answering a simple question: What actually happens w

More from this blog

T

TheSaurceCode

71 posts

Documenting my journey to becoming a Full Stack Developer through daily blogs, coding challenges, projects, tutorials, and lessons learned. Learn, build, and grow with me