// Lesson 6 of 49 · Network fundamentals
TCP, UDP and ports
The transport layer delivers data between applications, not just between hosts. Port numbers tell the receiving host which application the data is for.
TCP — connection-oriented and reliable
TCP guarantees that data arrives complete and in order:
- Three-way handshake before data: SYN → SYN-ACK → ACK.
- Sequence numbers put segments back in order.
- Acknowledgements confirm receipt; missing data is retransmitted.
- Windowing (flow control) lets the receiver say how much it can accept.
- Connections end with a FIN exchange (or abruptly with RST).
UDP — connectionless and lightweight
UDP just sends datagrams: no handshake, no acknowledgements, no retransmission. That makes it fast and suitable when late data is useless (voice, video) or when the application handles reliability itself (DNS queries, some file transfers).
| TCP | UDP | |
|---|---|---|
| Connection setup | Yes (handshake) | No |
| Reliability | Acknowledgements and retransmission | None |
| Ordering | Yes | No |
| Header | 20+ bytes | 8 bytes |
| Typical use | Web, email, file transfer, SSH | Voice, video, DNS, DHCP, SNMP, syslog |
Ports you should know
| Port | Protocol | Transport |
|---|---|---|
| 20/21 | FTP data/control | TCP |
| 22 | SSH / SCP | TCP |
| 23 | Telnet | TCP |
| 25 | SMTP | TCP |
| 53 | DNS | UDP and TCP |
| 67/68 | DHCP server/client | UDP |
| 69 | TFTP | UDP |
| 80 | HTTP | TCP |
| 110 | POP3 | TCP |
| 123 | NTP | UDP |
| 143 | IMAP | TCP |
| 161/162 | SNMP / SNMP traps | UDP |
| 443 | HTTPS | TCP (and UDP for HTTP/3) |
| 514 | Syslog | UDP |
A socket is the combination of IP address, protocol and port — for example 192.168.10.25:51834 talking to 203.0.113.10:443. The client picks a random high (ephemeral) source port.
Troubleshooting at layer 4
If a ping works but the application does not, test the port itself:
PS> Test-NetConnection 10.20.0.15 -Port 443
A TCP RST usually means "nothing is listening" or "a device actively refused it"; no answer at all usually means a firewall or ACL silently dropped it.
Key points
- TCP = reliable, ordered, connection-oriented (SYN, SYN-ACK, ACK).
- UDP = fast, no guarantees; used where speed matters more than retransmission.
- Memorise the well-known ports in the table.
- A working ping only proves layer 3; test the port to prove layer 4.
Sign in to save your lesson progress across devices. You can read every published lesson without an account.