*** Welcome to piglix ***

Port number


In the , a port is an endpoint of communication in an operating system. While the term is also used for female connectors on hardware devices (see computer port), in software it is a logical construct that identifies a specific process or a type of network service.

A port is always associated with an IP address of a host and the type of the communication, and thus completes the destination or origination network address of a communication session. A port is identified for each address and protocol by a 16-bit number, commonly known as the port number. For example, an address may be "protocol: TCP, IP address: 1.2.3.4, port number: 80", which may be written 1.2.3.4:80 when the protocol is known from context.

Specific port numbers are often used to identify specific services. Of the thousands of enumerated ports, 1024 well-known port numbers are reserved by convention to identify specific service types on a host. In the client–server model of application architecture, the ports that network clients connect to for service initiation provide a multiplexing service. After initial communication binds to the well-known port number, this port is freed by switching each instance of service requests to a dedicated, connection-specific port number, so that additional clients can be serviced. The protocols that primarily use ports are the transport layer protocols, such as the (TCP) and the (UDP).

Ports were unnecessary on direct point-to-point links when the computers at each end could only run one program at a time. Ports became necessary after computers became capable of executing more than one program at a time and were connected to modern networks.

Transport layer protocols, such as the (TCP) and the (UDP), specify a source and destination port number in their headers. A port number is a 16-bit unsigned integer, thus ranging from 0 to 65535. A process associates its input or output channels, via an Internet socket (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 processes 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.


...
Wikipedia

...