what are ports

mikha
mikha used Ask the Experts™
on
I'm trying to understand the concept of port.

I know the standard port number for http is 80.

is a particular protocol, such as http , tied to a particular port and it doesn't work in any other port?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
Most of these ports are bound to standards, and that makes the internet work pretty well. Standard ports are for web browsing, email etc etc.
However, it's not tied to that port if you wish to implement it differently. For your intranet, if there are reasons to, you can have a web server server you on port 8080 (and the browser url bar would look like this: https://intranet:8080/login.aspx).
For every protocol, you can veer away any way you want, as long as the program allows it (most do) and if the communication is clear (both the server and the client knows about it).
JohnBusiness Consultant (Owner)
Most Valuable Expert 2012
Expert of the Year 2018

Commented:
In simple conceptual terms, an application sends out a request via a port of its choosing (Port 80 is a convention) and gets the answer back on the same port. So an application can listen on its port and not have to scan through 65,000 ports for its information

I trusts this helps you.
JohnBusiness Consultant (Owner)
Most Valuable Expert 2012
Expert of the Year 2018

Commented:
Here is a picture of Ports in and out.

C--General_Storage-Current-Software-.png
CompTIA Security+

Learn the essential functions of CompTIA Security+, which establishes the core knowledge required of any cybersecurity role and leads professionals into intermediate-level cybersecurity jobs.

ste5anSenior Developer

Commented:
Ports are part of the address of a service. The IP identifies the machine where a service is hosted. And the port is local part to identify the service.

The well-known ports (port < 1024) are to be used by convention. This means that at port 80 of a machine should listen a http service.

This should also answer you question: A service ("protocol" by your terms) can listen at any port. Cause the service itself doesn't need to know about the port, it's just offering service at what ever port it is tied to.
Don JohnstonInstructor
Top Expert 2015

Commented:
One of the things I've noticed over the years is a lot of people get stuck on this concept.  Personally, I think the term "port" throws them off.  Not sure why though.

Anyway, one of the things I've tried to get past this is explain that rather than use the term "port", use application interface number (AIN).   This "number" is how the application tracks data to and from the network stack.  So when your application (Firefox) wants to communicate with a web server (google), it will send the traffic to 80 (because 80 is the defined, standardized number for web servers). But your app also has to have a number for the return traffic. Because you can have multiple sessions (or tabs or windows) to google, you'll pick an unused number.  Let's say 9876.  If you have a second session to google, it would have a destination number of 80 also, but the source number would be different than 9876.

HTH
JohnBusiness Consultant (Owner)
Most Valuable Expert 2012
Expert of the Year 2018

Commented:
Yes. You see above Dropbox using different ports (In and Out).
nociSoftware Engineer
Distinguished Expert 2018

Commented:
Port <1024 used to be special because only privileged system accounts could create those.
As anyone can configure their own system it's own privileged accounts that became a useless concept outside of the mainframe & server arena.

Well known ports are mentioned in the /etc/service (or equivalent files).
Well known ports also include ports > 1024. 1433 (SQL Server),   9100 JetDirect, 6000 (X11), 9200 (Wap), (5222, 5223) XMPP (fe. Whatsapp).

(note that the same concept in software are called sockets.)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial