Difference between IP address and Port Number

1. IP address :
An Internet Protocol address (IP address) is the logical address of our network hardware by which other devices identify it in a network. IP address stands for Internet Protocol address which is an unique number or a numerical representation that uniquely identifies a specific interface on the network. Each device that is connected to internet an IP address is assigned to it for its unique identification.

Addresses in IPv4 are 32-bits long example,

12.244.233.165 

And Addresses in IPv6 are 128-bits example,

2001:0db8:0000:0000:0000:ff00:0042:7879 

2. Port Number :
Port number is the part of the addressing information used to identify the senders and receivers of messages in computer networking. Different port numbers are used to determine what protocol incoming traffic should be directed to. Port number identifies a specific process to which an Internet or other network message is to be forwarded when it arrives at a server. Ports are identified for each protocol and It is considered as a communication endpoint.

Ports are represented by 16-bit numbers. 0 to 1023 are restricted port numbers are as they are used by well-known protocol services. 1024 to 49151 are registered port numbers means it can be registered to specific protocols by software corporations and in last 49152 to 65536 are used as private ports means they can be used by anybody.





Difference between IP address and Port Number :

Serial No IP address Port Number
01.  Internet Protocol address (IP address) used to identify a host in network. Port number is used to identify an processes/services on your system
02.  IPv4 is of 32 bits (4 bytes) size and for IPv6 is 128 bits (16 bytes). The Port number is 16 bits numbers.
03. IP address is the address of the layer-3 IP protocol. Port number is the address of the layer-4 protocols.
04. IP address is provided by admin of system or network administrator.  Port number for application is provided by kernel of Operating System.
05. ipconfig command can be used to find IP address . netstat  command can be used to find Network Statistics Including Available TCP Ports.
06. IP address identify a host/computer on a computer network. Port numbers are logical interfaces used by communication protocols.
07. 192.168.0.2, 172.16.0.2 are some of IP address examples. 80 for HTTP, 123 for NTP, 67 and 68 for DHCP traffic, 22 for SSH etc.

Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up

I am a Computer Science Engineering student, have a great interest in android application development & now mostly focusing on Internet of Things (IoT) applications

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.