I am fairly new to this stuff so bear with me. I have read several postings made with reference to ports(port 80 for example). What exactly are they, how many does a typical computer have, and what are they used for
Re: Computer ports(not serial or paralell)
15 years 1 month ago #1849
In short, Ports are used to specify a type of service you wish to use on a particular host.
Since your new to networking, it might be slightly difficult to understand this but we will keep it as simple as possible to help you understand the concept of a port.
If you want to connect to a certain computer on the internet, let's say our website, what information would you need to know ?
The answer is its IP Address, cause it identifies this specific server on the Internet. Its IP address is unique, meaning that there is only one machine on the Internet with this IP Address which is IP Address 18.104.22.168.
That's great, now we have the IP Address, we want to connect and download the website, just like you are doing right now, so you can read the reply to your post. The problem here is that this server with IP Address 22.214.171.124 dosen't only serve webpages, but also is a mail server, ftp server e.t.c.
This creates a new question ..... how on earth are you going to tell the server that you want to download the
This is where ports come into play! Using a specific port, in this example, port 80, you are specifying that you want the HTTP service.
This server, just like all other servers on the Internet has been configured to send websites to anyone who connects to them and specifies port 80.
In addition, should you decide that you needed to download a specific file from this machine by using the ftp protocol, you would be required to use the same IP address (which specifies this machine) and then port 21 (which specifies the FTP service).
Ports are analysed in a real nice way in the nearly completed new TCP protocol analysis, which I am hoping will be online within the next week.
If you bare with out, you will soon be able to read about ports in much detail and with awesome cool 3d diagrams that are used throughout the site.
Closing, let me give you one real life example that might help you related IP addresses and ports, helping you distinguish the difference:
You have decide to paint your house and need some paint, a light green colour is your selection.
So, you hit the road and start walking towards the nearest paint shop which your friend told you about and also supplied you with its addres ( the shop's address is similar to the IP Address of a computer in this example).
Since you have the address, you are able to find the shop without much trouble. You walk in the shop and are presented with a huge list of 1000 different colours. You look at the green colours and amazingly discover over 150 different colours of green! Since the difference between most is very small there are small codes under each sample (the codes are the equivelent to the 'port' concept)which you need to tell the sales person so he can fetch the correct one. You find the one you like and give the code to the sales man 'code 80', so he grabs the correct can and gives it to you.
If you didn't give him the correct code, would he have been able to know what you wanted ? No.
In a similar way, if you connect to IP Address 126.96.36.199, hows the machine suppose to know what you want from it? So you specify port 80, and it then knows you want to download the webpage and it serves it to you!
I hope that helps you understand what a 'port' is ! Keep in mind that there are thousands of ports, but we are only familair with a few of them, which also happen to be used in our everyday routine, those are: 21(ftp), 23(telnet), 80 (http-www), 110 (pop - used to download your email using e.g outlook) e.t.c
Hopefully by next week, the ports section will be online, so you can come back and read up on them.
To answer your question of how many ports there are.. well there are 65535 ports.. though port 0 is not implemented on a variety of operating systems.
Chris gave a really nice explanation.. but summarising things makes me feel important 8).. so basically since the TCP protocol can support many connections at one time, ports are TCP's way of identifying the different connections.
I have always maintained that TCP is one of the best protocols for a beginner to learn.. I was fortunate to accidentally pick up the RFC for TCP.. uhmm its RFC 793 if I'm not mistaken (RFC stands for Request For Comments, the RFC on a protocol is the standards defining document written by the creator of the protocol, so its the most complete authoritative work on the subject.. some of them are a little difficult to read.. but the TCP RFC is really well written.. even a layman would be able to figure out most of it). You can get the RFC from
Just to extend Chris's example, you can look at ports as the address of your house.
The street name is the computer you are trying to get to and the house number is the port.
Just remember that the the IP address will get you to the machine you are trying to reach. Ok, now what. You might have various services (programs) waiting for messages (browser, email, ftp, network connection from Windows Explorer, etc) all at the same time. These services are just listening and waiting for someone to talk to. Without some way to differentiate the messages, your machine won't know what to do with it. What it does is look at the port number inside the message. The message is given to the service that is waiting listening for a message from its particular port number. If the port number is 80, it is given to your browser.