How to connect to dedicated server when client default port is different

Hello guys, so my question goes as follows:

I have a few dedicated servers running on the same machine and each with different ports Ej:8889,8899,8999, etc. So each map is held by a different server.

As I’m running all the servers on the same machine, they all have the same IP, so to select one or other server I just have to type IP:8889or IP:8899, etc.(Ideally)

The thing is that after doing some tests, I have concluded that Unreal only permits a connection from Client to Server when the “built” port in the client (the one defined in the BaseEngine.ini) is the same as the Server one.
So I can only connect to the server with port 8889 if the client’s port is 8889.

My question is: Is there any way of overriding in “real-time” the client’s port so It matches the one that the server has?

Or, Is there any way of handling this architecture I’m trying to implement?

I’m quite sure I’m not the first one trying to set up different servers in the same machine so any help would be thank as I’ve been stuck with this for a few weeks now.

You can run multiple servers on one machine. You just need to make sure to specify different ports for your different servers.

the UE4Editor.exe file takes in arguments.

run UE4Editor.exe from you command line like so:

UE4Editor.exe 192.168.1.XX:PORT -server -log

UE4Editor.exe 192.168.1.XX:PORT -game -log

The first call creates a server. If you don’t specify a PORT and just use your local IP adress it will default to 7777.

Players will not create shortcuts to launch the game. He needs to change the port in the game itself.

Basically the way I’m trying to solve this problem is to have the client launch into a local standalone “lobby” map, then using some means (eg talking to a tracker/matchmaker by HTTPS) to discover a server running on some IP:PORT, and then connecting to that server by calling:

GetWorld()->GetFirstPlayerController()->ClientTravel("IP:PORT", TRAVEL_Absolute);

This changes the map and world (on the client) and connects to the game server running on IP:PORT (seemingly) just like you specified that IP:PORT on command-line. So far this seems to work.