TCP vs. UDP
TCP and UDP are the two main transport layer protocols. TCP is connection-oriented and reliable, retransmitting lost data and delivering it in order, while UDP is connectionless and unreliable, trading those guarantees for lower overhead and latency.
Both protocols sit at Layer 4 and use port numbers to deliver data to the right application, but they take opposite approaches to reliability. TCP (Transmission Control Protocol) establishes a session before any data moves, using the three-way handshake — SYN, SYN-ACK, ACK. It numbers every byte with sequence numbers, requires acknowledgments, retransmits anything unacknowledged, reassembles segments in order, and adjusts its sending rate through windowing and flow control. UDP (User Datagram Protocol) does none of this. It simply attaches a header and sends the datagram.
The cost of TCP's guarantees is overhead. A TCP header is 20 bytes at minimum and carries sequence numbers, acknowledgment numbers, window size, and flags; a UDP header is a fixed 8 bytes containing only source port, destination port, length, and checksum. TCP also adds latency: the handshake costs a round trip before the first byte of data, and a lost segment stalls delivery of everything behind it while the retransmission is awaited.
That trade-off determines which protocol an application chooses. TCP suits traffic where every byte must arrive intact — HTTP and HTTPS, SMTP, FTP, SSH, and file transfers. UDP suits traffic where timeliness beats completeness or where the exchange is a single short request and response — voice and video streaming, online gaming, DNS queries, DHCP, SNMP, TFTP, and syslog. In real-time media, a retransmitted audio packet would arrive too late to be useful, so it is better to drop it and move on. Applications that need some reliability over UDP implement it themselves at the application layer.
This comparison is foundational on the Cisco CCNA exam. Be ready to recognize the three-way handshake, identify header field differences and header sizes, and match well-known services to the correct protocol and port — DNS on 53 using both, DHCP on 67 and 68 over UDP, HTTPS on 443 over TCP, and SNMP on 161 over UDP.
Key takeaways
- TCP is connection-oriented and reliable; UDP is connectionless and best-effort.
- TCP uses a three-way handshake, sequence numbers, acknowledgments, retransmission, and flow control.
- UDP has an 8-byte header versus TCP's 20-byte minimum, giving it less overhead and lower latency.
- Use TCP for web, email, and file transfer; use UDP for voice, video, gaming, DNS, and DHCP.
- The CCNA tests handshake behavior, header differences, and which services run over each protocol.
