– Da LanTech –
This article was originally published on and is posted with permission of DaLanTech.com
More and more you may hear somebody talk about port numbers, but do you know what they are or how they are used?
First, a brief lesson on the Transport Control Protocol / Internet Protocol (TCP/IP) stack. All Internet communication uses TCP/IP. It has four layers, and each layer uses a different form of addressing. The Application Layer uses host names for addressing, the Transport Layer uses port numbers, the Internet Layer uses IP addresses, and the Network Layer uses MAC addresses.
Application Layer addressing is a no brainer: Every computer on a network has to have an IP address, and it would be impossible to remember the IP address of every site on the Internet! It is much easier to remember a regular name, like www.pcnineoneone.com, than it is to remember the IP address. Domain Name Resolution (DNS) takes care of finding the IP address for you.
But what about port numbers at the Transport Layer? Each application needs a unique port number, just like each web site needs a unique IP address. When you click on your web browser’s icon, the TCP/IP stack assigns a unique port number to your web browser as it is loading. Since port numbers below 1024 are reserved for services (more on this later), your web browser will be assigned a port number greater than 1023.
As an example I’m going to say that you have two web browser windows open, in the first one you are reading this page and in the second you are reading www.dalantech.com. Window number one was assigned port number 1025 and window number two was assigned 2045.
When you click on a hyperlink in window number one, the packet that you send to www.pcnineoneone.com was “tagged” with port number 1025 (source port). When the server that contains the PC 911 web page responds to your request for data, it sends a packet to you with port number 1025 in the destination port field of the packet. When your computer receives the packet it knows which application to give the data to by looking at the port number.
The same thing happens when you click on a hyperlink at www.dalantech.com (or any web site). The packets get tagged with port number 2045 (the second window) and when the server for Da LanTech sends a reply the packet has a destination port number of 2045 and the information loads into the second window.
You could have several browser windows open, but each one will have a unique port number randomly assigned to it. The only requirement is that the port numbers for client applications (a browser window, for example) have to be above 1023 -the port numbers from 1 to 1023 are reserved.