The dynamic port numbers (also known as the private port numbers) are the port numbers that are available for use by any application to use in communicating with any other application, using the internet's Transmission Control Protocol (TCP) or the User Datagram Protocol (UDP).
A port can be either hardware-based or software-based. A hardware-based port is a physical interface -- such as a jack or socket -- for connecting with other systems. A software-based port -- sometimes referred to as a virtual port -- is a logical communication endpoint that's managed by the host's operating system (OS). Software-based ports are numbered and can be assigned to specific processes or services. The host computer uses these ports to direct traffic to the associated process or service.
Software-based ports are identified by 16-bit integers that range from 0 to 65535. The ports can be either static or dynamic. A static port is one whose association with a process or service does not change. A dynamic port -- also called a private port -- is one that is assigned to a process or service at the time the port is needed, usually when the process or service is started. When assigning dynamic ports, the OS can use any ports available from the range of ports designated for this purpose.
Whether a port is static or dynamic, it's always associated with a protocol, usually TCP or UDP. Incoming connections must specify the correct port number in order to connect to the application or service, unless the port is implied by the type of communication.
For example, port 80 is reserved for communications that use Hypertext Transfer Protocol (HTTP). When users connect to a web application that uses port 80, they do not need to specify the port number in the Uniform Resource Locator (URL) because it's implied. However, if the web application uses a port other than 80, the port number must be added to the end of the URL, preceded by a colon, as in www.techtarget.com:443.
A port is identified by its port number. If the port is associated with a process or service, the port number also identifies that process or service. For this reason, when an application on one host computer communicates with an application on a different computer, the calling application usually specifies the target application's port number in each data transmission.
For example, the TCP header in an Internet Protocol packet transmitted over the internet includes both the source port and the destination port.
If an application knows the destination port number, it can call the number directly. If it does not know the port number, the application can use one of several methods to determine the number, such as querying the domain name system service records or making a system call that looks up the port number based on the service name.
The port numbering system has been standardized across the internet and provides a mechanism for registering service names and assigning port numbers. The Internet Assigned Numbers Authority (IANA) maintains this system, although the Internet Corporation for Assigned Names and Numbers now manages most IANA functions. That said, the port numbering functions are still presented as IANA services.
The port numbering system is described in Request for Comments (RFC) 6335, an Internet Engineering Task Force publication. RFC 6335 includes details about service name usage and port registries, as well a breakdown of the port number ranges. In addition to TCP and UDP, the port numbering system also applies to UDP-Lite, Stream Control Transmission Protocol and Datagram Congestion Control Protocol.
The registries for these protocols are divided into three categories, based on the available range of numbers (0 to 65535):
At any given time, a system or user port exists in one of the following three states:
Examples of system and user ports include the following:
Dynamic port numbers exist in a category separate from the other two because they can never be assigned or reserved. IANA has specifically set aside the port numbers in the dynamic range for local, private or temporary use, leaving it up to the host computers and application software to determine how and when to use these ports. However, application developers should not assume that a specific port number in the dynamic range will always be available.
27 Aug 2021