1. Home
  2. Explore
  3. Computer Science
  4. TCP vs UDP

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

TCP vs UDP

Speaker 1Speaker 2

TCP vs UDP

3:57
0:00-3:57
  1. Hope

    Alright, Anna, let's dive into Layer 4 today — the Transport Layer. We've talked about Layers 1, 2, and 3, but now it's time for TCP and UDP. The CCNA exam expects us to compare them, so let's start with the basics.

  2. Anna

    Good call. Layer 4 is all about getting data from one host to another, but the cool part is that it does it transparently — the hosts don't care what's happening down at the lower layers. It wraps data in a header and hands it off.

  3. Hope

    Exactly. And it provides — or doesn't provide — certain services. TCP is the heavy lifter: reliable data transfer, error recovery, sequencing, flow control. UDP? It's more like 'best effort' — it just sends data and hopes for the best.

  4. Anna

    But both of them share one crucial feature: Layer 4 addressing through port numbers. Those little numbers identify the application protocol — like HTTP on port 80 — and let a host handle multiple conversations at once. That's session multiplexing.

  5. Hope

    Right. Port numbers are split into ranges: well-known from 0 to 1023, registered from 1024 to 49151, and ephemeral from 49152 to 65535. When your computer picks a random source port, it usually grabs one from the ephemeral range.

  6. Anna

    And that's exactly what we saw in the example with PC1 connecting to two servers. Destination port 80 for HTTP, destination port 21 for FTP, and source ports like 50000 and 60000 from the ephemeral range.

  7. Hope

    Now let's talk TCP. Connection-oriented means before any data flies, the two hosts do a three-way handshake. SYN, SYN-ACK, ACK. Once that's done, the real communication starts.

  8. Anna

    And within that TCP header, there's a sequence number and acknowledgment number. They use something called forward acknowledgment — you acknowledge a segment by saying 'I expect the next sequence to be X'. That's how reliability and ordering work.

  9. Hope

    Plus, if a segment isn't acknowledged within a timeout, TCP retransmits it. That's a key difference from UDP. And for flow control, the window size field lets the receiver tell the sender 'slow down' or 'speed up' so it doesn't get overwhelmed.

  10. Anna

    But all those extra fields make the header bigger — 20 bytes at minimum. That's overhead. And the acknowledgments can slow things down. That's why for real-time stuff like voice or video, UDP is often preferred.

  11. Hope

    UDP is super simple. No connection setup, no acknowledgments, no retransmissions, no sequencing, no flow control. The header is just eight bytes — source and destination port, length, and a checksum. That's it.

  12. Anna

    So when do we use each? TCP for things like file downloads — you want every byte. UDP for VoIP calls — if a packet drops, it's better to move on than to wait for a retransmission. Some apps even handle reliability themselves on top of UDP, like TFTP.

  13. Hope

    And don't forget DNS — it usually uses UDP, but switches to TCP for larger responses. That's one of the few protocols that uses both.

  14. Anna

    Let's run through some well-known port numbers. FTP uses TCP ports 20 and 21. SSH uses TCP port 22. Telnet uses TCP 23. SMTP uses TCP 25. HTTP uses TCP 80. POP3 uses TCP 110. HTTPS uses TCP 443.

  15. Hope

    And for UDP: DHCP uses UDP 67 and 68. TFTP uses UDP 69. SNMP uses UDP 161 and 162. Syslog uses UDP 514. And DNS uses both TCP and UDP port 53.

  16. Anna

    Now, let's test ourselves. A practice question from Boson ExSim: drag applications to their transport protocol. DNS uses both, DHCP uses UDP, FTP uses TCP, HTTP uses TCP, SMTP uses TCP, SNMP uses UDP, TFTP uses UDP. Got it?

  17. Hope

    Perfect. Remember, the exam expects you to compare TCP and UDP — that means knowing what each provides and when to use them. Keep those port numbers in mind too. Great job today, Anna!

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent