Ports Number

The transport layer used two types of the ports number, the source port, and destination port. The source ports number belong to the originating application on the local host while the destination port numbers belong to the destination application on the remote host.

Port numbers are used to resolve what protocol incoming traffic should be directed to. It allows a single host with a single IP address to run different network services simultaneously. Each port number identifies a separate service, and each host can have 65535 ports per IP address.  The types of port are:-

Source Port

The source port numbers are dynamically generated by the originating device to identify a conversation between two devices. It 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 tracked based on the source port numbers.

Destination Port

The host can put a destination port numbers in the segment to tell the destination server about requested service. For example, when a client specifies port 53 in the destination port, the server receives the message requesting the DNS service.

A server can offer more than one service at the same time such as DNS services on port 53, FTP service on port 21 and web services on port 80 at the same time. The figure below illustrates the services of more than one service at the same time.

Ports Number

Socket Pairs

Source and destination port numbers are placed within the segment and then the segments encapsulated within an IP packet. The IP packet contains 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. We can recognize the server and service requested the user using a socket.

A user socket might look like this, while the port number is 1220 and the socket on an FTP server might be: Both source and destination socket combine to form a socket pair: for example and is a socket pair. The Figure above illustrates the connection and socket of DNS and FTP ports.

Multiple processes running on a client make possible by sockets. Socket differentiates themselves from each other and differentiates multiple connections to a server process from each other. The source ports number used as a return address for the requesting application. The transport layer keeps a track record of ports and the application that initiated the request so that when a reply returned, it can be forwarded to the correct application.

Port Numbers Groups

The Internet Assigned Numbers Authority (IANA) assigning various addressing standards and ports numbers. Port numbers are range from 0 to 65535 which is divided into three different types:-

Well-known Ports Number

Well, known port numbers are starting range from 0 to 1023. These ports are reserved for service and application. The applications such as email clients, web browsers, and remote access clients use these ports. We can program well-known ports for server applications and also a client application to request a connection to that specific ports and its associated service.

Registered Ports Number

The range of registered port numbers is starting from 1024 to 49151. The Internet Assigned Numbers Authority (IANA) assigned registered ports on requesting the person to use with particular processes or applications. These processes are generally 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

The range of dynamic or private port numbers is from 49152 to 65535The dynamic or private ports are also known as ephemeral ports. The ephemeral ports are generally assigned dynamically to the client’s operating system when a connection to a service is initiated.

We can use dynamic ports to identify the client’s application during communication. Some client operating systems also use registered port numbers as an alternative of dynamic ports numbers for assigning source ports.