35
ELI5: In computer networking, what is a port?
(lemmy.world)
Simplifying Complexity, One Answer at a Time!
Rules
There's something important missing from most of the other answers. There's a lot of different kinds of network and internet traffic. Web browsing, email, instant messaging, online video games...
By formal standard, certain port numbers are designated for certain functions. Web traffic happens on port 80. Incoming email is sent on port 143, outgoing email is sent on port 456 or 587. Something like Discord will have a specific port it uses for both sending and receiving messages. Word of Warcraft has certain ports its uses for telling the server when you cast a spell, and for the server to tell your client when you take damage.
So yes, ports are like PO boxes at a post office, but the analogy doesn't quite capture it. Port 80 is always web traffic, and this is important, since your web browser requests pages on port 80, just as a web server returns web pages on port 80. The web server probably has other ports on it, like FTP (ports 20 and 21) or SFPT (port 22). If you connect to a web server on port 80, that means you're asking for its webpages. If you connect on 20, 21, or 22, it means you're trying to transfer files to it.
All true, except almost all web traffic nowadays is over port 443 (HTTPS) instead of 80.
Almost true. Port 80 is usually used for unencrypted web traffic. But anything can be ran on any port. Standards are standards, not requirements.
You can run https, ftp, virus communication, DNS, or anything else on port 80. People trying to connect to it might get confused though.
I should give useful context though.
When you connect to a server, you send traffic to an IP address. That is like a street address with a letter. But when you send a letter in the mail, more than one person could live at a house, so you also include a name (or port number when sending to one service such as web traffic to a server that does many things). Usually that name corresponds to a person living there, like if you send a letter to John even though Sarah also lives there.
That is usually how it works, but not always. John and Sarah may have agreed that all letters should be named backwards, so John opens all letters to the name Sarah, and Sarah opens all letters to the name John. This would confuse anyone trying to send a letter to John unless John told them to use the name Sarah when sending a letter. Both could also agree that if a letter shows up for Bob, Sarah should open those as well (only Sarah's best friend would know to use the name Bob).
These exceptions are usually people either trying to obfuscate what is running on a port to pretend to be something different, it trying to make it hard to find the port associated with the server.