1 TCP, UDP, and Port Fundamentals
Learn how TCP and UDP carry application data, how ports identify endpoints, and how to interpret common protocol-and-port assignments.
How and deliver data
and are transport-layer protocols that carry data between applications on different devices. They use port numbers to identify the sending and receiving applications.
establishes a connection before exchanging data. It provides a reliable, ordered byte stream: lost data is retransmitted, and received data is acknowledged. Web browsing, email, and remote login commonly use .
sends separate messages called datagrams without first establishing a connection. does not itself guarantee delivery, order, or protection from duplicates. Its lower overhead can suit brief queries, voice or video, and other delay-sensitive traffic; an application can add its own reliability mechanisms if needed.
Neither protocol is universally better. The application's needs determine which is appropriate.
Port numbers and their ranges
A is a 16-bit number ranging from to , used with a transport protocol to identify an application endpoint on a device. and maintain separate port-number spaces, so port and port are distinct endpoints. A identifies a service convention, but it does not guarantee which program is actually using that port.
IANA divides port numbers into three ranges:
System (well-known): –, for common, standardized services.
User (registered): –, for registered application services.
Dynamic/private: –, often used for temporary client ports.
Client-server communication
In the usual client-server pattern, the client initiates communication to a server's IP address and service port. The server listens for requests, while the client uses a temporary port so the reply can be directed back to the correct application.
For example, a client might connect from 192.0.2.10:53000 to a web server at 203.0.113.20:443 using . The server's reply travels back to the client's address and port. Together, the source and destination addresses, source and destination ports, and transport protocol distinguish a .
With , the endpoints establish a connection before exchanging application data. With , the client sends a to the server; no -style connection handshake is required.
Common services and ports
These common or standard assignments can help identify likely services:
SSH: port , commonly used for secure remote login and command execution.
DNS: port and port , for domain-name lookups; DNS supports both transports.
HTTP: port , for unencrypted web traffic by default.
HTTPS: port ; HTTP/3 uses over , commonly on port , for encrypted web traffic.
DHCP: port for the server and port for the client, for automatic address and network-configuration assignment.
NTP: port , for network time synchronization.
These assignments are not proof of the traffic's actual contents. Services may use other ports, and traffic on a familiar port may not be the expected service. HTTPS is not synonymous with because HTTP/3 uses over .
Interpreting protocol-and-port pairs
Interpret a service as a transport protocol plus a , and use the assignment as a clue about the application.
Identify the transport. or changes how the traffic is delivered.
Read the port. port commonly indicates SSH; port commonly indicates NTP.
Check the context. A is often more informative about the intended server service than a temporary client .
Treat the result as a clue, not a certainty. Ports can be reassigned locally, services can use nonstandard ports, and registered port numbers do not authenticate traffic.
For example, a packet addressed to destination port is likely DNS traffic. A packet addressed to destination port may also be DNS; the alone does not reveal which query or response is being carried.