Ports, sockets and UDP
Port
A 16-bit number that picks the program on a device: web 80 and 443, DNS 53, SSH 22.
A port is a 16-bit number (0 to 65535) in the TCP or UDP header that names a program on a device. IP gets a packet to the device; the destination port gets it to the program. Servers listen on known ports, such as 443 for HTTPS, and clients use ephemeral ports picked by their kernel.
Read next
- Socket An address plus a port; a connection is named by both ends' sockets.
- TCP Reliable, ordered byte streams between programs: handshake, acknowledgements, retransmission.
- UDP Independent datagrams with ports and nothing else: no connection, no acknowledgement, no retries.
- Ephemeral port The temporary port a client's kernel picks for each outgoing connection.
- TCP reset A TCP packet that aborts a connection; the answer to a SYN for a port with no listener.
- FTP File transfer over two kinds of connection: commands on port 21, and a separate data connection per transfer.
- SMB/CIFS Windows-style file and printer sharing on TCP 445: a client logs in, connects to a named share, and reads or writes its files.
- RDP Remote graphical login on TCP 3389: the client negotiates a security layer, then runs the desktop inside TLS.
- SIP The signaling that sets up a VoIP call on port 5060: INVITE, ringing, 200 OK, ACK — then the audio flows separately over RTP.
- Port scanning Probing an address's ports to learn which services it exposes, and whether a firewall sits in the way.