Port Numbers

HostGator Web Hosting

There is two types of port are being used in a transport layer, the source ports, and destination ports. The source ports are related to the originating application on the local host. The destination ports are related to the destination application on the remote host.

Source Port

The source ports are dynamic ports, generated by the originating device to identify a conversation between two devices. This process allows multiple conversations to take place at the same time. It is common for a device to send multiple HTTP service requests to a web server at the same time. Each separate HTTP conversation is tracked based on the number of source ports.

Destination Port

The client attaches a destination port number in the segment to inform the destination server what service is being requested, For example, when a client specifies port 21 in the destination port, the server that receives the message knows that FTP services are being requested. A server can offer more than one service simultaneously such as FTP services on port 21 and web services on port 80 at the same time. The figure below illustrates both requests at the same time.

Socket Pairs

Both source and destination ports are placed within the segment and then the segments are encapsulated within an IP packet. The IP packet contains both the source and destination IP addresses. The combination of the source IP address and source port number, or the destination IP address and destination port number is known as a socket. The socket is used to recognize the server and service being requested by the user. A user socket might look like this, with 1124 representing the source port number: 192.168.10.200:1124 and the socket on a web server might be: 192.168.10.50:80

Together, these two sockets combine to form a socket pair: 192.168.10.200:1124, 192.168.10.50:80. The Figure below illustrates the connection and socket of web and FTP ports.

socket and port

The sockets are enabled multiple processes, running on a client, to differentiate themselves from each other, and multiple connections to a server process to be differentiated from each other. The source port number used as a return address for the requesting application. The transport layer keeps a track record of this port and the application that initiated the request so that when a reply is returned, it can be forwarded to the right application.

Ports Number Groups

The Internet Assigned Numbers Authority (IANA) is the authority for assigning various addressing standards and ports numbers. There are three different types of ports.

  • Well-known Ports (Numbers 0 to 1023) – These are the ports reserved for services and applications. These ports are generally used for applications such as web browsers, email clients, and remote access clients. These well-known ports can be programmed for server applications and client applications to request a connection to that specific ports and its associated service.
  • Registered Ports (Numbers 1024 to 49151)– These ports are assigned by Internet Assigned Numbers Authority (IANA) to a requesting person to use with particular processes or applications. These processes are mostly individual applications that a user has selected to install and use; rather than common applications that would receive a well-known port number.
  • Dynamic or Private Ports (Numbers 49152 to 65535)– These ports are also known as ephemeral ports; these are generally assigned dynamically by the client’s operating system when a connection to a service is initiated. The dynamic ports are then used to identify the client application during communication. Some client operating systems may be used registered port numbers instead of dynamic ports numbers for assigning source ports.
Please follow and like us: