A Port is an application-specific or process-specific software construct serving as a communications endpoint in a computer’s host operating system. 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. In the context of the Internet Protocol, a port is associated with an IP address of the host, as well as the type of protocol used for communication.
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.
Of the thousands of enumerated ports, about 250 well-known ports are reserved by convention to identify specific service types on a host.
The concept of port numbers was established by the early developers of the ARPANET in informal cooperation of software authors and system administrators.
The term port number was not yet used at this time. It was preceded by the use of the term socket number in the early development stages of the network. A socket number for a remote host was a 40-bit quantity. The first 32 bits were similar to today’s IPv4 address, but at the time the most-significant 8 bits were the host number. The least-significant portion of the socket number (bits 33 through 40) was an entity called another Eight bit Number, abbreviated AEN, today’s port number.
The 256 values of the AEN were divided into the following ranges:
|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.|
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 (for TCP, port number 0 is reserved and can’t be used. For UDP the source port is optional and a value of zero means no port). 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.
Port connection attempts are frequently monitored and logged by computers. The technique of port knocking uses a series of port connections (knocks) from a client computer to enable a server connection.
Use in URLs
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:
Well Known Ports
- 20 & 21: File Transfer Protocol (FTP)
- 22: Secure Shell (SSH)
- 23: Telnet remote login service
- 25: Simple Mail Transfer Protocol (SMTP)
- 53: Domain Name System (DNS) service
- 80: Hypertext Transfer Protocol (HTTP) used in the World Wide Web
- 110: Post Office Protocol (POP3)
- 119: Network News Transfer Protocol (NNTP)
- 143: Internet Message Access Protocol (IMAP)
- 161: Simple Network Management Protocol (SNMP)
- 194: Internet Relay Chat (IRC)
- 443: HTTP Secure (HTTPS)
- 465: SMTP Secure (SMTPS)