Multiple servers on one machine

Hi all,

I’ve bought a VPS for the hosting of my roleplay server. I’ve installed everything and literally copied the working files from my home pc.
Now the server works great, only the second server that runs at the same time keeps giving me the ‘listening on socket failed’. It says that only one ip/port combination can be used per running server.
I understand, only I host the second server on port 30121. I also tried port 30122, which gives the same error. I’ve opened the ports in the firewall (both TCP and UDP) and all ports are opened in the portforwarding automatically by the host.
What do i do?

Thanks in advance

1 Like

If I read it correctly you have the end points setup like this:

Server 1:

endpoint_add_tcp "0.0.0.0:30120"
endpoint_add_udp "0.0.0.0:30120"

Server 2:

endpoint_add_tcp "0.0.0.0:30121"
endpoint_add_udp "0.0.0.0:30121"

Sounds like the second server is still trying to bind 30120.

Correct. Any idea what causes it?

2 Likes

And you are sure both server use their own configs?

(i.e. in the .bat or .sh file).

1 Like

Yes. Both servers have their own locations and the serverstart.bat’s are specific for their own folders

If you shutdown the first server (maybe not do this if the first server is publicly available/production environment) and run the second server only…

Then run netstat -a -o -n to see the listening ports…

Do you see 0.0.0.0:30121 under the local adresses. If not, does it maybe show as 0.0.0.0:30120

All right, so I did what you asked and it now (while running server 2) says that it’s listening on 0.0.0.0:30121 & 0.0.0.0:30122
I find this odd, while I only run one instance of the FiveM server that should be listening on 30122…

Why 2 different ports though? I believe TCP and UDP get along fine on the same port. Maybe try that?

The thing is that I let my 2nd server only listen on port 30122 which I’ve opened in the firewall (both UDP and TCP). So I’m not sure what listens on 30121

That would probably be server 1?

Can you post the endpoints of the servers 1 server.cfg?

1 Like

Server 1 is not running.

server1

endpoint_add_tcp "0.0.0.0:30120"
endpoint_add_udp "0.0.0.0:30120"

server 2

endpoint_add_tcp "0.0.0.0:30122"
endpoint_add_udp "0.0.0.0:30122"

Strange, i’ve tried the exact same config on my machine and had no issues. Maybe something you are running is using a port that server 2 uses.

You should investigate with netstat

:frowning:

Okay, this is plain weird. I’ve started server 1, and it gives me this error:

Exception during executing Post callback: System.Net.Sockets.SocketException (0x
80004005): Only one usage of each socket address (protocol/network address/port)
 is normally permitted.

but I can connect to the server ('s, i can connect to both) without an issue. Problem solved I guess?

do port forwarding for the other ports too, like 30121