Copyright (c) 2026 MindMesh Academy. All rights reserved. This content is proprietary and may not be reproduced or distributed without permission.

2.5. TCP vs UDP

💡 First Principle: TCP and UDP both solve the problem of identifying applications (using port numbers), but they make opposite trade-offs: TCP guarantees delivery at the cost of speed; UDP maximizes speed at the cost of reliability. Think of TCP like certified mail—you get confirmation of delivery, but it takes longer. UDP is like shouting across a room—fast, but no guarantee anyone heard you.

What happens when you choose wrong: Imagine running VoIP over TCP. A packet gets lost. TCP dutifully waits, requests retransmission, and waits some more. Meanwhile, your voice call has a 500ms gap—the audio becomes unusable. Or imagine downloading a firmware image over UDP—one corrupted packet means a bricked device because there's no error recovery. Protocol choice directly impacts whether your application works.

Consider this scenario: Your video conference is choppy. Is it a TCP or UDP application? Video typically uses UDP—so the problem isn't retransmission delays. It's probably packet loss or jitter. If it were using TCP, choppiness would indicate network congestion triggering retransmissions. Knowing which protocol an application uses tells you where to look.

The exam tests whether you can match applications to protocols. When you see "real-time" or "latency-sensitive," think UDP. When you see "reliable" or "guaranteed delivery," think TCP.

Loading diagram...
Comparison:
FeatureTCPUDP
ConnectionConnection-oriented (handshake)Connectionless
ReliabilityGuaranteed delivery, orderingBest effort
OverheadHigher (20+ byte header)Lower (8 byte header)
SpeedSlowerFaster
Flow controlYes (windowing)No
Use casesHTTP, FTP, SSH, emailDNS, DHCP, VoIP, video
TCP Header Structure:
Loading diagram...

The flags (SYN, ACK, FIN, RST) control the connection lifecycle—they're what makes the three-way handshake and four-way teardown work.

TCP Three-Way Handshake:
  1. SYN: Client sends synchronize request
  2. SYN-ACK: Server acknowledges and sends its own SYN
  3. ACK: Client acknowledges server's SYN
TCP Connection Lifecycle:
Loading diagram...
Well-Known Port Associations:
ProtocolPortTransport
FTP Data20TCP
FTP Control21TCP
SSH22TCP
Telnet23TCP
DNS53TCP/UDP
DHCP Server67UDP
DHCP Client68UDP
TFTP69UDP
HTTP80TCP
NTP123UDP
SNMP161UDP
HTTPS443TCP

⚠️ Exam Trap: DNS uses both TCP and UDP. UDP for standard queries (faster), TCP for zone transfers and responses over 512 bytes.