-
-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: Stable network ports #840
Comments
The solution C-Dogs SDL uses is described here https://cxong.github.io/2016/01/how-to-write-a-lan-server where the listen port 34219 is only used for server discovery, and the game connection itself is on a random free port. This is to avoid having that port conflict with some other program, and also allow multiple servers on the same machine I don't know what's the canonical way of solving this, would you need to just add a firewall exception for cdogs-sdl? |
Choosing random ports works fine on a LAN, where there are no firewall or other restrictions. A simple solution could be to pick random ports from a small but known range (e.g. 34220-34300). Such a fixed range can be easily configured in most routers. Or maybe allow for configuration of the randomly chosen ports. Then the user can decide for themselves what ports to use.
On the machine itself it would be easy to allow every port of a program like cdogs-sdl, but the router (which is a different device) does not know the ports that cdogs-sdl is using, so it can't automatically forward them. |
I think it would be best to add a cmd line arg to specify the port to serve; since there is no standard way to specify a range for selecting a random port, we'd have to repeatedly bind() which could be very slow. |
I was just playing cdogs-sdl with a friend over the Internet, which is quite fun!
It was a bit annoying that besides the main listening port (34219), it opens additional random ports that need to be reachable.
So to achieve a connection, I had to lookup the open ports and re-configure my router (firewall/NAT).
It would be nice if cdogs-sdl would choose the open ports from a predictable range (even better if only one port would be sufficient), so that the router needs to be configured only once.
The text was updated successfully, but these errors were encountered: