this post was submitted on 09 Apr 2024
223 points (95.1% liked)
Asklemmy
43801 readers
801 users here now
A loosely moderated place to ask open-ended questions
Search asklemmy ๐
If your post meets the following criteria, it's welcome here!
- Open-ended question
- Not offensive: at this point, we do not have the bandwidth to moderate overtly political discussions. Assume best intent and be excellent to each other.
- Not regarding using or support for Lemmy: context, see the list of support communities and tools for finding communities below
- Not ad nauseam inducing: please make sure it is a question that would be new to most members
- An actual topic of discussion
Looking for support?
Looking for a community?
- Lemmyverse: community search
- sub.rehab: maps old subreddits to fediverse options, marks official as such
- [email protected]: a community for finding communities
~Icon~ ~by~ ~@Double_[email protected]~
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
They're defined by the software that listens for incoming connections. For example, a web server will (by default) open a listening port on port 80, as that's what is defined in the http standard. If said server supports https (which most of them do) it will also open a listening socket on 443.
It's easy to reconfigure a webserver (or any other server) to listen on any other port instead, provided that it's not already claimed by a different server software. The only caveat is that any clients that want to connect will have to specify the correct port. For example, if the webserver is instead running on port 1234, you'd type http://example.com:1234/ in the address field.
Ports are identified by their number which is in the range of 1 through 65535. The first 1024 ports are "official", which can often be observed by the fact that most of the fundamental protocols that makes the internet function is in this range (http, https, ftp, ssh, dns, smtp, pop3, imap just to name a few). And on linux systems, opening a listening socket on a port below 1024 requires root privileges.
It's worth noting that no port number is "better" than any other. Port 2 will work just as well as 22222. It's just a way for a server to know which server software should receive the incoming packets.
A bit beyond what you're asking, but I consider it a natural furtherance thereof: you can talk to a webserver manually by using telnet. It's easy, I just don't remember the syntax in my head, but it's an easy question for google.