Couldn't bind on

Hey, So I made a script that starts bat files to restart the server, everytime it executes the bat files to start the server again, it says that:

Could not bind on 0.0.0.0:30120 - is this address valid and not already in use?

So this only happens if the server gets automaticly restarted with a Lua file and it doesn’t matter how much time I set to wait in:
timeout time /nobreak
It will always give the same message and you can’t connect to the server.

steps to reproduce:

make a simple server side lua file and paste this:
( this is only needed cause you can’t execute from lua directly a bat with a timeout function, cause it closes instantly again… may be another bug)

RegisterCommand("testthat", function()
 os.execute("kick_restart.bat")
end)

close it and of course save it.

now go to the folder where your server.cfg is located and create two bat files,
one with the name “kick_restart.bat” and the other one with the name “restart.bat” and open both.

in kick_restart.bat paste this:

@echo off
start restart.bat

in restart.bat paste this:

@echo off
Taskkill /FI "WINDOWTITLE eq C:\Windows\system32\cmd.exe - SimpleServerStarter.bat
::only change the name above again with the name your server start bat has.
timeout 30 /nobreak
start SimpleServerStarter.bat
::only thing to change above is after the ' - ' the name of your server start bat.

that’s it. You will have the same problem as me…

thanks for reading if someone has any questions, ask me, I’m here. :slight_smile:

bump!

still no way for it, it is just weird when I restart it manually it does’t have any problem and as soon I restart the server over LUA with os.execute it can’t bind because the address is in use…

any way to “quit” the connection to FiveM for a moment? Also tried killing FXServer.exe, and it didn’t work…

any solutions are great! :slight_smile:

If this goes forever now, then I guess the FiveM team should take a look over it…
I mean how?? There must be something that gets closed when I manually close the server and with LUA’s help it does not… Nothing in task manager, what could look like it belongs to running FiveM server, nothing…

anyway, have a nice day!