Set port through command line?

Moderator: NADEO

Post Reply
Bmandk
Posts: 6
Joined: 22 Jul 2020, 21:26

Set port through command line?

Post by Bmandk »

Hi, I'm trying to run multiple servers on my machine (for new Trackmania), and I'm wondering if it's possible to specify which port the server should use through the command line. I've already tried with /forceip and /bindip, but none of them are working and my room in Trackmania just shows the server as down.
User avatar
Miss
Posts: 2155
Joined: 05 Jan 2016, 11:34
Location: The Netherlands
Contact:

Re: Set port through command line?

Post by Miss »

It's best to set this in the configuration file passed through "/dedicated_cfg" rather than the command line. You'd have a different configuration file for each server.

Is there a specific reason you'd need this on the command line?
3080 RTX, Ryzen 3700X, 32GB RAM, Windows 11
Forum moderator, opinions are my own. :thx:
Check out Image openplanet, the alternative ManiaPlanet & Turbo scripting platform! (Openplanet subforum)
I also stream and tweet.
Bmandk
Posts: 6
Joined: 22 Jul 2020, 21:26

Re: Set port through command line?

Post by Bmandk »

Yes, I've created a docker image so I can start multiple servers easily on my machine. But this also means that public port is dynamically assigned to each instance.

I've also tried setting it in the file directly by editing it before starting the server, but it's the exact same result.

From my testing, it seems that the server will not bind to the right port. The masterserver does get the right ip:port, as I can listen to the /bindip port with another tool and get a reponse when trying to connect from Trackmania. But if I try to listen to the port set in the cfg, then it says it's already bound.

So I think there's a bug where the server does not listen bind itself to the right port. The same results also happen with /bindip.
oliverde8
Posts: 1345
Joined: 16 Jun 2010, 07:33
Location: in a Blue Box

Re: Set port through command line?

Post by oliverde8 »

Not sure I understand,

- you can start the dedicated server and make it listen always port 2350
- Then map it when doing the docker run, for example -p 2355:2350 -p 2355:2350/udp

I didn't test it with the new Trackmania dedicated server but you can look at this docker https://github.com/oliverde8/Dockerfile ... -dedicated that was inspired from what MiniGod had done. It should work the same.
Image
Developper for The next generation, Clean and Powerfull controller eXpansion for your SM & TM server . Working on eXpansion² with full MP4 support and many other awesome features...
Bmandk
Posts: 6
Joined: 22 Jul 2020, 21:26

Re: Set port through command line?

Post by Bmandk »

Thanks for the example. I had a quick look at it, and it does indeed use /forceip with a port given as environment variable, the exact same thing I was doing. It just doesn't work with new TM. I think /forceip (and the CFG) is bugged.
Bmandk
Posts: 6
Joined: 22 Jul 2020, 21:26

Re: Set port through command line?

Post by Bmandk »

Let me try to explain what I did to test that it's bugged.

First, tested with barebones. No forceip, just normal port (3000) in the CFG. This works, and I can connect to my server.

Then, I try with /forceip=$MY_PUBLIC_IP:3000. Same port, still works.

Then I try with /forceip=$MY_PUBLIC_IP:3001. Doesn't work. (Yes, I also tried with this as default, which worked, so it's not the port being closed).

While the server was running with /forceip=$MY_PUBLIC_IP:3001, I used netcat to listen to port 3001. I go into Trackmania and open the room, and netcat gets a response. If I try to attach netcat to 3000, it says the port is already in use.

So I think that /forceip does send the right ip:port to Nadeo's masterserver, but does not actually bind the dedicated server.
oliverde8
Posts: 1345
Joined: 16 Jun 2010, 07:33
Location: in a Blue Box

Re: Set port through command line?

Post by oliverde8 »

That's normal, I think I couldn't explain myself.

/forceip tells the master server that users should connect on the servers port 3001 but it does not tell the dedicated server to listen to port 3001. The dedicated server will continue to listen to the port configured in the config file.

But then if you route port 3001:3000 when starting the container it doesn't matter, as the docker listens to port 3001 and routes it to port 3000 inside the container.

You can start as many container as you wish this way, all dedicated servers listens to port 3000 but the routing &/forceip allows it to work.

Basically the user connects on port 3001 of the server, the OS sends that to running container on port 3001, docker knows that it needs to send it inside to the dedicated servers port 3000

Hope I am clear
Image
Developper for The next generation, Clean and Powerfull controller eXpansion for your SM & TM server . Working on eXpansion² with full MP4 support and many other awesome features...
Bmandk
Posts: 6
Joined: 22 Jul 2020, 21:26

Re: Set port through command line?

Post by Bmandk »

Ah, I guess I had misunderstood how it works. Now it works, thank you so much!
oliverde8
Posts: 1345
Joined: 16 Jun 2010, 07:33
Location: in a Blue Box

Re: Set port through command line?

Post by oliverde8 »

:thumbsup:
Image
Developper for The next generation, Clean and Powerfull controller eXpansion for your SM & TM server . Working on eXpansion² with full MP4 support and many other awesome features...
Post Reply

Return to “Dedicated Server”

Who is online

Users browsing this forum: No registered users and 1 guest