IP vs Port

With the latest developments in information and communication technology (ICT), every nook and cranny of the vast globe is interconnected. The basis for this great victory is mainly due to the rapid development of communication and networking technologies. The building blocks of these miracle creations are based on the concepts of IP addressing and ports.
Millions of servers and clients on the Internet use IP addresses and ports to communicate with each other.

IP Address

The IP address is a 32-bit logical address used to determine the destination of a data packet (datagram). IP address identifies the source and destination networks that allow the datagram to travel accordingly on the specified route. Every host and router on the Internet has an IP address, just like all phones have a unique identification number. The concept of IP addressing was standardized in 1981.

In principle, the dotted decimal notation is used in IP addressing. Normally, an IP address is made up of two parts, the network part and the host part. The usual arrangement of an IP address is as follows:

Each of the 4 bytes (8 bits = 1 byte) consists of values ​​ranging from 0 to 255. The IP addresses are grouped into classes (A, B, C and D) according to the size of the network identifier and the host identifier. When this approach is used to determine IP addresses, it is identified as full class addressing. Depending on the type of network to be created, an appropriate address scheme must be selected.

Example of IP:

Class A => For some networks, each with several hosts.

Class C => For many networks, each with a few hosts.

Generally, in a LAN environment considered, the network identifier of the IP address remains the same, the host part varying.

One of the big drawbacks of full class addressing is the waste of IP addresses. Thus, the engineers adopted the new approach to classless addressing. Unlike full class addressing, the size of the network identifier is variable here. In this approach, the concept of subnet masking is used to determine the size of the network identifier.

Example for an ordinary IP address is

The ports

Ports are represented by 16-bit numbers. As a result, ports range from 0 to 65,525. Port numbers between 0 and 1023 are restricted because they are reserved for the use of known protocol services, such as HTTP and FTP.

In a network, the endpoint, with which two hosts communicate with each other, is identified as a port. Most ports are assigned to an allocated task. These ports are identified by the port number, as indicated above.

The functional behavior of the IP address and the port is therefore as follows. Before sending the data packet from the source machine, the source and destination IP addresses as well as the corresponding port numbers are transmitted to the datagram. Using the IP address, the datagram follows and reaches the destination machine. Once the package is released, using port numbers, OS directs the data to the correct application. If the port number is lost, the operating system does not know which data to send to which application.

In summary, the IP address therefore has the essential task of directing the data to the desired destination, while the port numbers determine the application to be supplied with the data received. Finally, with the corresponding port number, the allocated application admits the data via the reserved port.