Port (computer networking)

From Wikipedia, the free encyclopedia
Jump to: navigation, search

In computer networking, a port is an application-specific or process-specific software construct serving as a communications endpoint in a computer's host operating system. A port is associated with an IP address of the host, as well as the type of protocol used for communication. The purpose of ports is to uniquely identify different applications or processes running on a single computer and thereby enable them to share a single physical connection to a packet-switched network like the Internet.

The protocols that primarily use ports are the Transport Layer protocols, such as the Transmission Control Protocol (TCP) and the User Datagram Protocol (UDP) of the Internet Protocol Suite. A port is identified for each address and protocol by a 16-bit number, commonly known as the port number. The port number, added to a computer's IP address, completes the destination address for a communications session. That is, data packets are routed across the network to a specific destination IP address, and then, upon reaching the destination computer, are further routed to the specific process bound to the destination port number.

Note that it is the combination of IP address and port number together that must be globally unique. Thus, different IP addresses or protocols may use the same port number for communication; e.g., on a given host or interface UDP and TCP may use the same port number, or on a host with two interfaces, both addresses may be associated with a port having the same number.

Of the thousands of enumerated ports, about 250 well-known ports are reserved by convention to identify specific service types on a host. In the client-server model of application architecture, ports are used to provide a multiplexing service on each server-side port number that network clients connect to for service initiation, after which communication can be reestablished on other connection-specific port numbers.

Technical details[edit]

Transport Layer protocols, such as the Transmission Control Protocol (TCP) and the User Datagram Protocol (UDP), specify a source and destination port number in their packet headers. A port number is a 16-bit unsigned integer, thus ranging from 1 to 65535 (port number 0 is reserved and can't be used). A process associates its input or output channels via Internet sockets, a type of file descriptor, with a transport protocol, a port number and an IP address. This process is known as binding, and enables sending and receiving data via the network. The operating system's networking software has the task of transmitting outgoing data from all application ports onto the network, and forwarding arriving network packets to a process by matching the packet's IP address and port number. Only one process may bind to a specific IP address and port combination using the same transport protocol. Common application failures, sometimes called port conflicts, occur when multiple programs attempt to bind to the same port numbers on the same IP address using the same protocol.

Applications implementing common services often use specifically reserved, well-known port numbers for receiving service requests from client hosts. This process is known as listening and involves the receipt of a request on the well-known port and establishing a one-to-one server-client connection, using the same local port number; other clients may continue to connect to the listening port. This works because a TCP connection is identified by the tuple {local address, local port, remote address, remote port}.[1] The well-known ports are defined by convention overseen by the Internet Assigned Numbers Authority (IANA).








Use in URLs[edit]

Port numbers can occasionally be seen in a web or other service uniform resource locator (URL). By default, HTTP uses port 80 and HTTPS uses port 443, but a URL like http://www.example.com:8080/path/ specifies that the web resource be served by the HTTP server on port 8080. The active transport layer protocol ports may be discovered on many operating systems (Windows, Unix-like, z/OS) with the command line netstat -a.

Common port numbers[edit]



The registered ports are those from 1024 through 49151. IANA maintains the official list.[2] The dynamic or private ports are those from 49152 through 65535. One common use is for ephemeral ports.


The concept of port numbers was established by the early developers of the ARPANET in informal cooperation of software authors and system administrators.






  • 0 through 63: network-wide standard functions
  • 64 through 127: host-specific functions
  • 128 through 239: reserved for future use
  • 240 through 255: any experimental function


1  Telnet
3  File transfer
5  Remote job entry
7  Echo
9  Discard

In the early ARPANET, the AEN was also called a socket name,[7] and was used with the Initial Connection Protocol (ICP), a component of the Network Control Program (NCP)[8][9] NCP was the forerunner of the modern Internet protocols. Today the terminology service name is still closely connected with port numbers, the former being text strings used in some network functions to represent a numerical port number.

See also[edit]


  2. ^ "Port Numbers". Internet Assigned Numbers Authority (IANA). 
  3. ^ RFC 36, Protocol Notes, S. Crocker (16 March 1970)
  8. ^ NIC 7104, ARPANET Protocol Handbook