IP vs Port
With the latest developments of information and communication technologies (ICT) every nook and corner of the vast globe is interconnected. The basis of this wonderful victory is mainly due to rapidly evolving communication and networking technologies. The building blocks of these miracle creations are based upon the concepts of IP addressing and ports.
Through IP addresses and ports, millions of servers and clients on the internet are communicating with each other.
IP address is a logical 32 bit address which is used to determine the destination of a data packet (datagram). IP address identifies the source and destination networks which allow the datagram to flow accordingly in the specified route. Every host and router on the internet has an IP address, just like all telephones have a unique number for the identification purpose. The concept of IP addressing was standardized in 1981.
Basically dotted decimal notation is being used in IP addressing. Normally an IP address consists of two parts as network portion and the host portion. Ordinary arrangement of an IP address is as follows:
Each of the 4 bytes (8 bits = 1byte) consists of values ranging from 0-255. IP addresses are grouped into classes as (A, B, C and D) depending on the size of the network identifier and the host identifier. When this approach is being used in determining the IP addresses, it is identified as class full addressing. Depending on the type of the network to be created, have to select a suitable address scheme.
E.g.: Class A=> For few networks , each with many hosts.
Class C=> For many networks, each with few hosts.
Mostly, within a considered LAN environment network identifier of the IP address remains same, where as host part is varying.
One of the big disadvantages caused by class full addressing is wastage of IP addresses. So, engineers moved into the new approach of class less addressing. Unlike in the class full addressing, here, size of the network identifier is variable. 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 126.96.36.199
Ports are represented by 16-bit numbers. Hence ports range from 0-65,525. The port numbers from 0 -1023 are restricted, because they are reserved for the use of well known protocol services such as HTTP and FTP.
In a network, the end point, which two hosts communicate with each other are identified as ports. Most of the ports are assigned with an allocated task. These ports are identified by the port number as discussed earlier.
So the functional behavior of the IP address and the port is as follows. Before sending the data packet from the source machine, source and destination IP addresses along with the respective port numbers are fed to the datagram. With the help of the IP address, datagram tracks the destination machine and reaches it. After the packet is unveiled, with the help of the port numbers OS is directing the data to the correct application. If the port number is misplaced, OS is unaware which data to be sent to which application.
So as a summary, IP address does the big task of directing the data to the intended destination, whereas port numbers determine which application to be fed with the data received. Eventually with the respective port number, allocated application admits the data through the reserved port.