1.4 TCP vs. UDP

Key Takeaways

  • TCP is connection-oriented with a three-way handshake (SYN, SYN-ACK, ACK).
  • UDP is connectionless with no handshake, acknowledgments, or retransmission.
  • TCP provides reliable, ordered delivery; UDP provides best-effort, faster delivery.
  • TCP uses flow control (windowing) and congestion control; UDP does not.
  • Common TCP ports: HTTP (80), HTTPS (443), SSH (22), FTP (20/21), Telnet (23), SMTP (25).
Last updated: March 2026

TCP vs. UDP

The Transport Layer (Layer 4) of the OSI model provides end-to-end communication between applications. The two primary transport protocols are TCP (Transmission Control Protocol) and UDP (User Datagram Protocol). Understanding their differences is critical for the CCNA exam.

TCP (Transmission Control Protocol)

TCP is a connection-oriented protocol that provides reliable, ordered delivery of data. Before any data is sent, TCP establishes a connection using a three-way handshake.

The TCP Three-Way Handshake

The handshake establishes a connection between two hosts:

  1. SYN — Client sends a SYN (synchronize) segment to the server
  2. SYN-ACK — Server responds with SYN-ACK (synchronize-acknowledge)
  3. ACK — Client sends a final ACK (acknowledge) to complete the connection

After the three-way handshake, data transfer begins. When communication is complete, a four-way teardown (FIN, ACK, FIN, ACK) closes the connection.

TCP Reliability Mechanisms

MechanismFunction
Acknowledgments (ACKs)Receiver confirms receipt of data segments
Sequence numbersEach byte is numbered, enabling ordered reassembly
RetransmissionUnacknowledged segments are resent after a timeout
Windowing (flow control)Receiver advertises how much data it can accept
ChecksumDetects data corruption in transit
Congestion controlAdjusts sending rate to avoid network congestion

TCP Windowing

Windowing is TCP's flow control mechanism. The receiver advertises a window size indicating how many bytes it can accept before requiring an acknowledgment.

  • Small window → slower but more reliable on lossy links
  • Large window → faster throughput on reliable links
  • Window size adjusts dynamically based on network conditions

TCP Header

The TCP header is 20 bytes minimum (without options) and includes:

  • Source port (16 bits)
  • Destination port (16 bits)
  • Sequence number (32 bits)
  • Acknowledgment number (32 bits)
  • Flags: SYN, ACK, FIN, RST, PSH, URG
  • Window size (16 bits)
  • Checksum (16 bits)

UDP (User Datagram Protocol)

UDP is a connectionless protocol that provides best-effort delivery with minimal overhead. There is no handshake, no acknowledgments, and no retransmission.

UDP Characteristics

CharacteristicDetail
ConnectionConnectionless (no handshake)
ReliabilityBest-effort (no guaranteed delivery)
OrderingNo sequence numbers (no ordered delivery)
Flow controlNone
Overhead8-byte header (minimal)
SpeedFaster than TCP (less processing)
RetransmissionNone (if a packet is lost, it's lost)

UDP Header

The UDP header is only 8 bytes:

  • Source port (16 bits)
  • Destination port (16 bits)
  • Length (16 bits)
  • Checksum (16 bits)

TCP vs. UDP Comparison

FeatureTCPUDP
Connection typeConnection-orientedConnectionless
ReliabilityGuaranteed deliveryBest-effort delivery
OrderingOrdered (sequence numbers)Unordered
HandshakeThree-way handshakeNone
Flow controlWindowingNone
Congestion controlYesNo
Header size20+ bytes8 bytes
SpeedSlower (more overhead)Faster (less overhead)
RetransmissionYes (automatic)No
Use casesWeb, email, file transferStreaming, VoIP, DNS lookups, gaming

Common Port Numbers

Well-Known TCP Ports

PortProtocolDescription
20FTP DataFile Transfer Protocol data channel
21FTP ControlFile Transfer Protocol control channel
22SSHSecure Shell (encrypted remote access)
23TelnetUnencrypted remote access (avoid)
25SMTPSimple Mail Transfer Protocol (email sending)
53DNSDomain Name System (also uses UDP)
80HTTPHypertext Transfer Protocol
110POP3Post Office Protocol v3
143IMAPInternet Message Access Protocol
443HTTPSHTTP Secure (TLS/SSL encrypted)
993IMAPSIMAP over TLS
995POP3SPOP3 over TLS

Well-Known UDP Ports

PortProtocolDescription
53DNSDomain Name System (queries)
67DHCP ServerDynamic Host Configuration Protocol
68DHCP ClientDHCP client port
69TFTPTrivial File Transfer Protocol
123NTPNetwork Time Protocol
161SNMPSimple Network Management Protocol
162SNMP TrapSNMP notifications
514SyslogSystem logging

Protocols Using Both TCP and UDP

PortProtocolWhy Both?
53DNSUDP for standard queries; TCP for zone transfers and large responses

On the Exam: Memorize the common port numbers listed above. Questions like "Which port does HTTPS use?" or "Which transport protocol does TFTP use?" are among the easiest points on the exam.

When to Use TCP vs. UDP

Use TCP when:

  • Data integrity is critical (file transfers, web browsing, email)
  • You need guaranteed, ordered delivery
  • The application cannot handle missing data

Use UDP when:

  • Speed is more important than reliability (real-time voice/video)
  • Small, quick requests (DNS lookups, NTP queries)
  • The application handles its own error correction
  • Multicast or broadcast communication is needed (DHCP)
  • A lost packet is better than a delayed packet (VoIP, gaming)
Loading diagram...
TCP Three-Way Handshake and Four-Way Teardown
Test Your Knowledge

What are the three steps of the TCP three-way handshake in the correct order?

A
B
C
D
Test Your Knowledge

Which port number is used by HTTPS?

A
B
C
D
Test Your Knowledge

Which transport protocol would be most appropriate for real-time voice communication (VoIP)?

A
B
C
D