Skip to content
TechToolsHQ
NewsReviewsGuidesTech 101Tech SeriesToolsNewsletter
TechToolsHQ

Independent, research-driven tech coverage — breaking news, in-depth reviews, buying guides, and technical tutorials to help you understand and choose with confidence.

Explore
NewsReviewsGuidesTech 101Tech SeriesFree Tools
Legal
About UsOur AuthorsContact UsPrivacy PolicyTerms of ServiceCopyright & DMCAAffiliate DisclosureEditorial PolicyAdvertise With Us

© 2026 TechToolsHQ. All rights reserved.

Tech Series/DevOps/TCP vs UDP: The Internet's Two Ways to Move Data
DevOps · Part 6 of 6

TCP vs UDP: The Internet's Two Ways to Move Data

One is reliable, one is fast — and knowing which a service uses tells you how it fails.

By Himanshu Bhatt· 4 min read· October 1, 2026

TCP vs UDP — article hero.
Key Takeaways · TL;DR
  • TCP and UDP both live in the transport layer; they decide how data moves, not where it goes.
  • TCP is reliable: it guarantees delivery, keeps data in order, re-sends what is lost, and drops duplicates.
  • TCP is connection-based — it opens a connection with a handshake before sending anything.
  • UDP is connectionless and best-effort: no handshake, no delivery guarantee, no ordering — but it is fast.
  • Use TCP when reliability matters (HTTP, HTTPS, SSH, FTP, databases); use UDP when speed matters more (DNS, streaming, gaming, metrics).
  • When debugging, first ask whether the thing that broke is TCP-based or UDP-based — it points you at the cause.
☰ On this page(show)(close)
  • 1.The big question
  • 2.Where TCP and UDP sit
  • 3.TCP: the reliable one
  • •What “connection-based” means
  • •Common DevOps errors when TCP fails
  • •What uses TCP
  • 4.UDP: the fast one
  • •Why UDP exists
  • •What uses UDP
  • 5.TCP vs UDP, side by side
  • 6.How this changes your debugging
  • 7.Testing a port from the command line
  • 8.A real example: DNS that sometimes fails
On this page
  • 1.The big question
  • 2.Where TCP and UDP sit
  • 3.TCP: the reliable one
  • •What “connection-based” means
  • •Common DevOps errors when TCP fails
  • •What uses TCP
  • 4.UDP: the fast one
  • •Why UDP exists
  • •What uses UDP
  • 5.TCP vs UDP, side by side
  • 6.How this changes your debugging
  • 7.Testing a port from the command line
  • 8.A real example: DNS that sometimes fails
INFO

Part 6 of the DevOps series. In Parts 4 and 5 we followed data down through the OSI and TCP/IP layers. Now we zoom into one of those layers — the transport layer — and the two protocols that live there: TCP and UDP.

The big question

When one computer sends data to another, we have to answer a few questions. Does the data actually arrive? Does it arrive in the right order? And if something goes missing on the way, is it re-sent? There are two different answers to this problem, and you will see their names constantly in DevOps: TCP and UDP.

Where TCP and UDP sit

Both TCP and UDP live in the transport layer of the stack we built up in earlier parts. The layer below them, IP, decides where the data goes — the destination address. TCP and UDP decide how it gets there: reliably, or quickly.

Where TCP and UDP sit: both live in the transport layer of the stack (Application, Transport, IP, Network). They decide how data moves, not where it goes.
TCP and UDP are the two answers the transport layer offers to the same question: how do we move this data?
Layer architecture
LAYER 4
Application - HTTP, SSH, databases, the real payload
LAYER 3
Transport - TCP or UDP, this is HOW the data moves
LAYER 2
IP - the IP address, this is WHERE the data goes
LAYER 1
Network - the physical path the bits travel over

TCP: the reliable one

TCP — the Transmission Control Protocol — is the protocol you will deal with most as a DevOps engineer. Its whole job is to make data transfer dependable.

  • The data arrives — nothing is silently dropped.
  • The data arrives in order, even if individual packets take different paths.
  • Anything lost along the way is automatically re-sent.
  • Duplicate data is detected and removed.

What “connection-based” means

Before TCP sends any real data, it does something important: it opens a connection. Conceptually it is a short back-and-forth — the client asks “can we talk?”, the server says “yes”, and the client confirms. This is the TCP handshake. If the handshake fails, nothing else happens — no data is ever sent.

The TCP handshake: the client asks can I connect, the server replies yes, and the client confirms. A connection opens before any data is sent, which is why TCP is connection-based.
The three-step handshake is why TCP is called connection-based.
●The TCP Handshake
Client asks
can I connect
Server
yes
Client confirms
  • •A connection opens before any data is sent.
  • •This back-and-forth is why TCP is called connection-based.
  • •If it fails you see connection refused or connection timed out.

Common DevOps errors when TCP fails

When a TCP connection cannot be established, you run into a familiar set of errors:

  • Connection refused
  • Connection timed out
  • No route to host

These usually mean the application itself might be running fine, but TCP could not open a connection to it. The common causes are a firewall rule, a closed port, an app that is not listening, or simply the wrong IP or port.

What uses TCP

Almost everything you touch day to day runs on TCP, because for most things reliability matters more than raw speed.

ProtocolUses TCP?
HTTPYes
HTTPSYes
SSHYes
FTPYes
DatabasesYes

UDP: the fast one

UDP — the User Datagram Protocol — solves a different problem. Instead of guaranteeing reliability, it optimises for speed.

  • Sends data immediately — no handshake, no connection.
  • Does not guarantee the data arrives.
  • Does not guarantee the order it arrives in.
  • Does not detect or re-send what is lost.

In short, UDP is fast but unreliable by design — and for some jobs, that trade is exactly right.

PRO TIP

A simple way to picture it: TCP is like a phone call, where you talk step by step and know the other person heard you. UDP is like shouting a message across a crowded room — fast, but you are just hoping it lands.

Why UDP exists

If UDP drops data, why use it at all? Because sometimes speed matters more than perfection, and losing a little data is perfectly acceptable.

  • DNS queries
  • Video streaming
  • Online gaming
  • Metrics and monitoring systems

In all of these, waiting for TCP to retry a lost packet would do more harm than just moving on. A dropped frame in a video, or a single missed metric sample, is not worth stalling for.

What uses UDP

Use caseProtocol
DNS (mostly)UDP
MetricsUDP
Service discoveryUDP
StreamingUDP

DNS is a good example of the nuance here: it usually sends its queries over UDP first for speed, and only falls back to TCP when it has to — for example, when a response is too large to fit in a single UDP packet.

TCP vs UDP, side by side

Put next to each other, the trade-off is clear. TCP spends time to be reliable; UDP skips that time to be fast. Neither is “better” — they are built for different jobs.

TCP vs UDP side by side. TCP opens a connection, guarantees delivery, keeps order, re-sends lost data, but is slower; used by HTTP, HTTPS, SSH, FTP, databases. UDP has no connection and no guarantees but is very fast; used by DNS, streaming, gaming, metrics.
If reliability matters, use TCP. If speed matters more than perfection, use UDP.
Specifications
TCP: connection-based, reliable, in order, re-sends lost data, slower
UDP: connectionless, best-effort, unordered, no re-sends, very fast
Use TCP when: HTTP, HTTPS, SSH, FTP, databases
Use UDP when: DNS, streaming, gaming, metrics
FeatureTCPUDP
ConnectionYesNo
Reliable (guaranteed delivery)YesNo
OrderedYesNo
SpeedSlowerFaster
DevOps usageVery highMedium

How this changes your debugging

Knowing which protocol a service uses is a genuine debugging shortcut. When something breaks, two quick questions point you in the right direction: is this TCP-based or UDP-based, and does it expect reliability?

  • An HTTP API that will not respond is almost always a TCP problem — a port, a firewall, or a service that is not up.
  • DNS that works sometimes and fails other times often points to UDP packet loss plus a shaky network.
  • Metrics that go missing are frequently just dropped UDP packets — not a bug in the app.

Testing a port from the command line

You can check reachability for both protocols with netcat (nc). The flags differ because the protocols differ — one checks for a connection, the other just fires a packet.

# Checks if TCP port 443 is open and reachable
nc -vz example.com 443
# Sends a UDP packet to port 53 (best-effort reachability check)
nc -vu example.com 53

Notice the difference: the TCP check actually confirms a connection was established, while the UDP check can only send a packet and hope — because UDP gives you nothing back to confirm with.

A real example: DNS that sometimes fails

Here is a problem you will eventually hit: your app can resolve DNS most of the time, but every so often it fails to connect. The reason is baked into how DNS works — it uses UDP, UDP packets can be silently dropped, and if your resolver or client has no retry logic, that dropped query just looks like a failure. This is exactly why DNS caching and sensible retries matter so much in production.

INFO

That is the transport layer: TCP for reliability, UDP for speed, and the judgement to know which a service should use. Next in the DevOps series, we go one level up to the system that turns names into addresses — DNS.

This article was drafted with AI assistance and reviewed by a human editor before publishing.

Share
Series: DevOps

Part 6 — TCP vs UDP: The Internet's Two Ways to Move Data

Part 6 of 6
← Previous partPart 5 — The TCP/IP Model: How Data Really Flows on the Internet
Latest episode in this series.

Enjoying the DevOps series?

TechToolsHQ is an independent, reader-supported tech platform. If this article saved you time, solved a tough problem, or helped you learn a new skill, consider supporting our work. Your support helps us keep our in-depth series 100% free and updated for everyone.

100% optional · Reader supported · Independent researchSupport our work

Don't miss the next deep-dive

Weekly breakdowns of the tools students and builders actually use.

No spam·Unsubscribe any time·Privacy-first