Let's suppose you want to implement a multitier application. It could be just a
client-server one, or a client-AppServer-DBServer one, or even a 4-tier application.
If you want these applications to communicate through a LAN or whatever type of
network (using TCP/IP or UDP) you will need to use ports. A port is basically an
indication for "through where" should your application be listening and/or
sending the information from/to the other application. Another way to see them is
as "the names of the end of the logical connections which carry long term
For example, SMTP uses port 25 and POP3 uses port 110. If someone would try to
communicate with you sending you an e-mail not using port 110, you would never
receive that e-mail, because your e-mail program would not "see" the communication,
as POP3(most used today) protocol only listens to port 110.
Another point to take care of are collissions. Let's say your application uses
port 100 to listen for its communications. If there is any other application
running on the same machine and listening to the same port it could happen that
the other application gets the info which was for yours. Or your application
would probably get info that was destined to the other. In both cases the
applications will surely not know what to do with that information, and it will
So now that we know why we need to use ports and know if there is no other
application using them, which port could you use?
Well, that is something really easy to know. You only have to connect to the IANA
(Internet Assigned Number Authority) and have a look at the last updated Port
Numbers list. Direct link is:
There you get not only a list of all the 65535 ports available, but also an
explanation about the 3 categories of ports that exist : Well Known, Registered
and Dinamic and/or Private. Basically, Well Known Ports are assigned by IANA and
usually used for privileged or root/system processes; Registered Ports are listed
by IANA and used for ordinary processes; and Dinamic and/or Private Ports are
neither registred nor listed (you can use them but you can not know if they are
used by others).