CompTIA Network+ (V9)
TCP vs UDP and common ports for Network+
TCP sets up a connection with a three-way handshake and then gives a reliable, in-order byte stream. UDP sends each datagram at once with no connection, no delivery guarantee and no duplicate protection. IANA records which port and transport each service uses, and several exam questions turn on the transport, not just the number.
TCP or UDP
RFC 9293 calls the three-way handshake the procedure used to establish a TCP connection. A receiver does not hand data to the application until the connection reaches the ESTABLISHED state. TCP then detects lost packets with sequence numbers and errors with checksums, and retransmits.
RFC 768 says UDP is transaction oriented and that delivery and duplicate protection are not guaranteed. There is no setup, so the first datagram carries the request straight away.
Pick UDP when one short request expects one short reply and the application resends on its own if no reply comes. Pick TCP when the application needs every byte in order and does not want to handle loss itself.
Ports to know (IANA registry)
File and remote access: FTP data 20 and control 21, SSH 22, Telnet 23, TFTP 69, 3389 registered as ms-wbt-server (used by RDP), 445 registered as microsoft-ds (used by SMB).
Name, address and time: DNS 53 on both UDP and TCP, DHCP 67 server and 68 client, NTP 123.
Mail: SMTP 25, POP3 110, IMAP 143, IMAPS 993, POP3S 995, submission 587, submissions 465.
Management and directory: SNMP 161, SNMP traps 162, LDAP 389, LDAPS 636, syslog 514.
Web, database and voice: HTTP 80, HTTPS 443, Microsoft SQL Server 1433, SIP 5060, SIP over TLS 5061.
Where the transport matters
Syslog: IANA lists syslog on 514 over UDP only. TCP 514 is registered to a different service, shell. RFC 5426 says a syslog receiver listens on UDP port 514 by default. A firewall in front of a collector with default settings must allow UDP 514.
Mail submission: RFC 8314 describes two methods. With STARTTLS the client opens a cleartext session and then issues a command that upgrades it to TLS; that is used on port 587. With Implicit TLS the TLS handshake starts as soon as the TCP connection opens; for submission that is port 465. Port 25 is SMTP between mail servers.
The same split applies elsewhere: LDAP 389 versus LDAPS 636, and SIP 5060 versus SIPS 5061.
Where the exam catches people
- Believing syslog defaults to TCP 514: IANA registers syslog on UDP 514; TCP 514 belongs to shell.
- Believing port 465 is the STARTTLS submission port: 465 is Implicit TLS. STARTTLS upgrades a cleartext connection on 587.
- Believing UDP discards duplicate or out-of-order datagrams: RFC 768 gives no such guarantee, so the application must handle it.
- Believing TCP delivers data before the handshake completes: data waits until the connection reaches ESTABLISHED.