HomePort

Port

A port is a 16-bit number used by Layer 4 protocols such as TCP and UDP to identify which application should handle a packet on a host. Think of the IP address as a building’s street address and the port as an extension number for a specific room. When your browser connects to a website, it does not talk only to an IP. It talks to a socket made of four parts: source IP, source port, destination IP and destination port. The destination port tells the server which service you want, for example a web service or a mail service. The source port is usually chosen automatically by your device from a temporary range so replies can find their way back to the right app. Ports let many conversations share one IP at the same time. They also enable demultiplexing, which is the simple act of sorting incoming traffic to the correct process.

• Port ranges run from 0 to 65,535. 0 is reserved. 1–1023 are well-known ports used by standard services. 1024–49,151 are registered ports for specific applications. 49,152–65,535 are dynamic or ephemeral ports that clients pick for short-lived connections.
• Common examples: 80 for HTTP, 443 for HTTPS, 53 for DNS, 25 for SMTP, 22 for SSH, 123 for NTP, 3389 for RDP. Services can run on other ports, but these are the defaults most people see.
• TCP vs UDP: both use ports, but TCP adds connections, ordering and reliability, while UDP sends independent datagrams without a handshake. Servers “listen” on a TCP port. With UDP, servers wait for datagrams on that port.
NAT and port translation: home routers and many gateways rewrite source ports on the way out so many devices can share one public IPv4 address. Inbound mappings, often called port forwarding, send traffic on a chosen public port to a private host.
• Open, closed and filtered: if a service is listening you will see the port as open. If nothing is listening it appears closed. Firewalls can drop probes so a port looks filtered.
• Names and registries: operating systems map numbers to names like http or ssh in a services file. The IANA registry records the official assignments, but running a service on a non-standard port is allowed.
• Not a physical port: a transport port is a software identifier, not a socket on the chassis. It lives in headers inside each TCP or UDP segment.

In practice, clients choose an ephemeral source port and connect to a server’s well-known destination port. The server uses that 4-part socket to keep each session separate, even when many users connect at once. This simple numbering scheme is what lets the Internet carry millions of different application flows over the same links without confusion.