2.1 Compare and contrast TCP and UDP ports, protocols, and their purposes
📘CompTIA A+ Core 1 (220-1201)
When computers talk to each other over a network, they need rules to send and receive data. These rules are called protocols. Two of the most important protocols are TCP and UDP. Both are part of the Transport Layer in the TCP/IP model, but they work differently.
1. TCP (Transmission Control Protocol)
Definition:
TCP is a connection-oriented protocol. This means it establishes a connection between two devices before sending data. Think of it as a guaranteed delivery system.
Key Characteristics of TCP:
| Feature | Explanation |
|---|---|
| Reliable | TCP ensures that all data is delivered. If a packet is lost, TCP will retransmit it. |
| Connection-Oriented | TCP requires a “handshake” to start communication (3-way handshake). |
| Data Ordering | TCP numbers packets so they arrive in the correct order. |
| Error Checking | TCP checks for errors in transmission using checksums. |
| Flow Control | TCP prevents overwhelming the receiver by controlling the rate of data sent. |
How TCP Works in IT environments:
- Web Browsing (HTTP/HTTPS): TCP ensures the web page loads completely and correctly. Every file, image, and script is delivered in order.
- Email (SMTP, IMAP, POP3): TCP makes sure the email message is sent and received fully.
- File Transfers (FTP, SFTP): TCP guarantees that all files arrive intact, even if network problems occur.
Ports Used:
TCP uses ports to identify services on a device. Examples include:
- 80 – HTTP
- 443 – HTTPS
- 21 – FTP
- 25 – SMTP (sending email)
2. UDP (User Datagram Protocol)
Definition:
UDP is a connectionless protocol. It sends data without first establishing a connection and does not guarantee delivery.
Key Characteristics of UDP:
| Feature | Explanation |
|---|---|
| Unreliable | UDP does not check if the data arrived or was correct. |
| Connectionless | No handshake is required; data is sent immediately. |
| No Ordering | Packets may arrive out of order. |
| Low Overhead | UDP has less extra data, so it’s faster than TCP. |
| No Flow Control | It doesn’t adjust for the speed of the receiver. |
How UDP Works in IT environments:
- DNS Queries: UDP quickly asks a DNS server for the IP address of a website. Speed is more important than guaranteed delivery because if a response is missed, the query can be resent.
- Streaming (Video/Audio): UDP sends data continuously for live streams or video calls. Missing a few packets is okay, so the stream continues smoothly.
- VoIP (Voice over IP) Calls: UDP transmits voice packets fast without waiting for confirmations, which keeps the call in real time.
Ports Used:
UDP also uses ports for services. Examples include:
- 53 – DNS
- 67/68 – DHCP
- 123 – NTP (Network Time Protocol)
- 69 – TFTP (Trivial File Transfer Protocol)
3. Key Differences Between TCP and UDP
| Feature | TCP | UDP |
|---|---|---|
| Connection | Connection-oriented | Connectionless |
| Reliability | Reliable; guarantees delivery | Unreliable; no delivery guarantee |
| Ordering | Ensures packets arrive in order | Packets may arrive out of order |
| Speed | Slower due to error checking | Faster, less overhead |
| Use Case | Web pages, emails, file transfers | Streaming, DNS lookups, VoIP |
4. Summary for the Exam
- TCP = reliable, connection-oriented, slower, used for important data (websites, emails, file transfers).
- UDP = fast, connectionless, less reliable, used for speed-sensitive tasks (streaming, DNS, VoIP).
- Remember: Both use ports to identify specific services. TCP and UDP can use the same port number for different purposes, but the protocol type matters.
💡 Exam Tip:
When you see a question asking, “Which protocol is better for streaming video?”, the answer is UDP because speed matters more than reliability.
If the question asks, “Which protocol ensures all parts of a file are delivered correctly?”, the answer is TCP.
