Question

I have a piece of multiplayer game software which is approaching maturity and will hopefully be in a public testing phase soon. For informal private tests, I've been using a port number that I'm fond of, which falls in the User Port range, 1024-49151. I'm wondering if it will behoove me to register a port with the IANA (in this case, I can't use my current port because it's already used by a very obscure service).

I'm a bit puzzled at the fact that we are told not to utilize User Ports without registering them, and yet most major multiplayer games (e.g. Call of Duty, Team Fortress 2, Minecraft) use numbers in this range with no registration. Are games not considered to be a "significant" use of this range, warranting registration? Should I avoid this issue altogether and pick a number from the Dynamic (Ephemeral) range, 49152-65535? I just wonder why most games avoid this upper range if it obviates the need for IANA registration (fear of collision with a temporary port?). Or needn't I worry about registration at all? I'm just trying to be a responsible netizen as I prepare to release my first networking application. Thanks.

Was it helpful?

Solution

If a specific port must be opened on each individual client *, you need to register a port in the User Ports range, because of of RFC 6335, 8.1.2.:

[...] application software MUST NOT assume that a specific port number in the Dynamic Ports range will always be available for communication at all times [...]

On your server (if any) you can use any port, without registration. However I'd recommend using a port in the Dynamic Ports range there as well. Your clients could then fetch a list of servers and their current port numbers from some kind of master server (for example via HTTP / Port 80 or HTTPS / Port 443). That way you 1. eliminated mis-used User Ports and 2. can change your actual server ports at any time.


*: If your players are behind a NAT, client-side ports have to be forwarded in the NAT settings; that will make your game hard to play for inexperienced users. It is probably a better idea to redirect all traffic through your server(s)...

If you use a server somewhere and you really need a client-side protocol you can circumvent the issue of registering with the IANA by opening a random dynamic port instead and notifying the server of that port, which then notifies all clients wanting to connect. That way, you don't need any user port at all, and thus no registration. But this makes it even harder for users behind a NAT.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top