On: Ephemeral and High-range ports use for local application static assignment
Categories EngineeringThe port numbers are divided into three ranges: the well-known ports, the registered ports, and the dynamic / private ports (a subset of which are used for ephemeral port assignment). Seeing 127.0.0.1:55555 being used for local application w/ static port assignment is not “correct” (it’s not really “incorrect” either, hence quotation marks) 4 2 reasons.
1. Ephemeral port range:
55555 is used on many a system as an ephemeral port. Meaning applications like curl, chrome, firefox, sql RDBMS clients can try using it. Which is not a problem for them, since they will know the port is used an will try another one… more of a problem for the application that tries to statically claim that port, on the rare occasions when it is already in use.
To find out the ephemeral ports (on *nix systems and windows respectively (yea, the windows registry does not hold those parameters unless they are set through the registry – not sure if this is a patterns in windows services: keep the default parameters to yourself and honor the registry only when there is something – it might be)):
[email protected]:~$ cat /proc/sys/net/ipv4/ip_local_port_range 32768 60999
D:\GDrive\CS\Cpp\NetBeans_Cpp>netsh int ipv4 show dynamicport tcp Protocol tcp Dynamic Port Range --------------------------------- Start Port : 1025 Number of Ports : 64510
2. Convention breaking:
The Internet Assigned Numbers Authority (IANA) suggests the range 49152 to 65535 (2^15+2^14 to 2^16−1) for dynamic or private ports. And the world is slowly-but-surely moving towards it and I would say that is a good convention.
I start to think that I’m a bigger fan of conventions that I thought.