TCP vs UDP: The Real Difference, With Real-Life Examples
TCP and UDP are the two main transport protocols on the internet. TCP sets up a connection first, numbers every byte, resends anything lost and delivers data in order, so web pages, email and file downloads arrive complete. UDP just sends independent datagrams with no handshake, no retransmission and no ordering, which makes it lighter and lower in delay.
Topic: Networking in IT Infrastructure · Comparison
Quick answer: TCP and UDP are the two main transport protocols on the internet. TCP sets up a connection first, numbers every byte, resends anything lost and delivers data in order, so web pages, email and file downloads arrive complete. UDP just sends independent datagrams with no handshake, no retransmission and no ordering, which makes it lighter and lower in delay. That suits DNS lookups, voice and video calls, live streaming and online games, where a late packet is useless anyway. Modern protocols blur the line: QUIC, used by HTTP/3, runs over UDP but adds its own reliability and encryption.
Key takeaways
- TCP trades some delay for reliability; UDP trades reliability for low delay.
- The choice depends on the application, not on which protocol is better.
- DNS mostly uses UDP but switches to TCP for large responses and zone transfers.
- QUIC rebuilds reliability on top of UDP for faster web connections.
- Each protocol has typical attack patterns that defenders should monitor.
Table of Contents
- What Do TCP and UDP Actually Do?
- How Do TCP and UDP Compare Side by Side?
- Which Everyday Apps Rely on TCP?
- Which Everyday Apps Rely on UDP?
- Why Do DNS and QUIC Use Both Ideas?
- How Do Attacks Differ for TCP and UDP?
- How Do You Choose Between TCP and UDP?
- References
What Do TCP and UDP Actually Do?
Both sit at the transport layer and use port numbers to reach the right application. The difference is how much care they take.
TCP (RFC 9293) opens a connection with a three-way handshake (SYN, SYN-ACK, ACK), tracks sequence numbers, acknowledges data, resends lost segments and slows down when the network is congested. Think of a courier who needs a signature for every parcel.
UDP (RFC 768) is only a few pages long. It adds ports, a length and a checksum to each datagram and sends it. Think of dropping postcards in a letterbox: fast and cheap, but nobody tells you if one goes missing.
How Do TCP and UDP Compare Side by Side?
| Feature | TCP | UDP |
|---|---|---|
| Connection | Handshake before data | None |
| Reliability | Acknowledgements and retransmission | None built in |
| Ordering | Guaranteed in order | Not guaranteed |
| Header size | 20 bytes minimum | 8 bytes |
| Flow and congestion control | Yes | No |
| Data unit | Byte stream | Individual datagrams |
| Broadcast and multicast | No | Yes |
| Best for | Completeness | Low delay |
Which Everyday Apps Rely on TCP?
- Web browsing (HTTP/1.1 and HTTP/2): one missing byte would break a page or a script.
- Email (SMTP, IMAP): a message must arrive whole.
- File transfer and downloads (SFTP, HTTPS): a corrupted installer is worse than a slow one.
- Remote access (SSH, RDP): every keystroke must arrive in order. RDP can also use UDP for smoother display.
- UPI and online banking apps: transactions run over HTTPS, which until HTTP/3 means TCP.
Which Everyday Apps Rely on UDP?
- DNS lookups: a single small question and answer; if lost, the client simply asks again.
- Voice and video calls: media travels over RTP (RFC 3550), usually on UDP. Resending a lost word half a second later only makes the call worse.
- Online gaming and live sports streams: the latest position matters more than an old one.
- DHCP: a new device has no IP address yet, so it broadcasts over UDP.
- NTP, SNMP and syslog: small, frequent messages.
Why Do DNS and QUIC Use Both Ideas?
DNS starts on UDP port 53, but RFC 7766 requires support for TCP too. Large answers, such as DNSSEC responses, get truncated over UDP and the client retries over TCP. Zone transfers always use TCP.
QUIC (RFC 9000) takes the opposite route. It runs over UDP but adds its own acknowledgements, retransmission, congestion control and built-in TLS 1.3. HTTP/3 (RFC 9114) runs on QUIC, so a lost packet delays only one stream instead of the whole page. This is why you may see UDP 443 traffic in firewall logs.
How Do Attacks Differ for TCP and UDP?
| Threat | Protocol | Defence |
|---|---|---|
| SYN flood (half-open connections) | TCP | SYN cookies, rate limits, DDoS protection |
| Session hijack or reset injection | TCP | Encryption (TLS, SSH), randomised sequence numbers |
| Reflection and amplification (DNS, NTP, memcached) | UDP | Close open resolvers, BCP 38 source filtering |
| IP address spoofing | Mainly UDP | Ingress and egress filtering |
Because UDP has no handshake, a spoofed source address goes unchecked. That is the basis of the amplification attacks described by CISA alert TA14-017A.
How Do You Choose Between TCP and UDP?
Ask one question: is late data still useful? If every byte must arrive, choose TCP. If fresh data beats complete data, choose UDP, or a UDP-based protocol like QUIC that adds only the reliability you need.
For the simplest explanation, read IP, TCP and UDP explained like I am 5, and to see how TCP manages connections, read about TCP communication flags. Build these skills in our CCNA and networking training.
References
Frequently Asked Questions
What's Your Reaction?
Like
0
Dislike
0
Love
0
Funny
0
Wow
0
Sad
0
Angry
0