Networking · 09 · 4 min read

TCP, UDP and ports

IP brings data to the right computer; the port brings it to the right program.

TCP — reliable

TCP opens a connection with a three-way handshake (SYN → SYN-ACK → ACK), numbers every byte, resends what gets lost and keeps the order. Used when every bit matters: web pages, email, files, SSH.

UDP — fast

UDP just sends, with no handshake and no resends. A lost packet is simply skipped — perfect for calls, games, live video and DNS, where late data is useless anyway.

Ports to know

PortProtocolUsed for
22SSHSecure remote login
25SMTPSending email
53DNSName lookups
80HTTPWeb (unencrypted)
443HTTPSWeb (encrypted)
3389RDPWindows remote desktop