0
cb219
2y

Why do any tutorials on any kind of technology start their projects on ports like 3000/8080/4200/5000 and so on? Why not start them on port 1/2/3/65536/etc.? Are these chosen tutorial ports free to use? Any special meaning? I've looked up a table of ports and many ports have a specific purpose but are still (mis)used for that arbitrary whatever project?

Comments
  • 7
    Aren't lower ports reserved for system things? Like the ports below 255 or something?

    I think ports are only special if currently being used. Like port 80.

    Edit:

    I should've searched:

    https://stackoverflow.com/questions...
  • 3
    Just don't use any port here and you'll be fine.

    https://iana.org/assignments/...

    Some software will use a random port and cause conflicts if you have the same port in use for your own projects.
  • 1
    Think of ports like channel frequencies managed by the FCC or ipv4 address space managed by IANA.

    There's ports reserved for everything.

    Port 8080 or 8000 is typically used for local intranet broadcasting for HTTP or other streaming services (like rtsp).

    Think of these ports like you think of your local network IP, most the time these will be along the lines of 192.168.x.x

    Those first two sets of numbers are widely accepted to determine a local network IP. Port 8xxx can also be thought of the same way (with a few exceptions).

    Regardless, you can set the port anything runs on usually but it's not really recommended unless you know exactly what you're doing.
  • 1
    A port is a port is a port.

    The ports 0 - 1023 are reserved for well-known applications,
    1024 - 49151 can be reserved by IANA.

    But in reality you can pick anything above 1023

    Cause: A port is a port is a port.

    Meaning: Say you have Host A.

    Host A runs Docker.

    Then only external ports of containers matter - as these are associated with the IP of Host A.

    Back to the triplet:

    A port cannot be assigned multiple times to a single IP address, it will fail - for obvious reasons.

    A port is just a number that is associated with a IP to match a service.

    So... A port is a port is a port....
  • 0
    read rfc 7605, 6056
    also this
    https://en.m.wikipedia.org/wiki/...
  • 2
    Additionally to what has been said in https://stackoverflow.com/a/... (Answer to Question on StackOverflow linked by @Demolishun), tutorial ports tend to be easy to remember for obvious reasons.

    8080 and 8443 are derived from the official ports for HTTP(S).

    3000, 4000, ... are easy to remember because they are just full thousands.

    Ports like 12751 would make the reader wonder, how the author came up with that. Humans in general try to find reason behind things. So you should never just use random ports in a tutorial to not distract from the actual topic...
  • 1
    Same reason every example you find has "foo" and "bar". Someone used those ports specifically, and someone else went "Oh, that looks like a good idea" and now everyone uses them because everyone else uses them. You can use any port that isn't currently being used
  • 0
    0 to 1023 are known ports https://en.m.wikipedia.org/wiki/... and I thi k ports around 2000-something can be used by services.

    It's become practice to jump by a thousand when a range is occupied.

    Which is why 3000 is common.
  • 0
    I think it's entirely about picking a number which is easily guessable in case your run some web server locally and it doesn't console log the port number - you just randomly start visiting some known port numbers.

    Once in a while you build a server while you need to have other severs running locally and then you might pick a unique port. Usually pick a famous number and do +1 like 8081.
Add Comment