- Feb 10, 2018
- 799
- 1,746
If his server binds to INADDR_ANY how it is supposed to notify the client which port it chose?Instead of binding to 3000 he should bind to 0 to get a random socket from the OS. There are other details.
You must be registered to see the links
Port 3000 is not assigned to anything else so it's not a terrible option. I personally usually go for more oddball port numbers to reduce the chance of collision, but it's not necessary.
What I suspect may be happening is that the server is buggy and sometimes it gets wedged at startup. When this happens people kill their game and try to restart, but the server doesn't shut down properly so it sits on the port until their machine is rebooted.
To test this theory, next time the game fails to start quit the client and open a cmd prompt to run a "netstat -an" and look for a line with "0.0.0.0:3000" or "127.0.0.1:3000" in it. If that line says "LISTEN" then there's still a server running and sitting on the port. If it is in one of the WAIT states then DS forgot to set SO_REUSEPORT on his socket and you have to wait for the OS to time it out (5 minutes I think) before it can be used again.
It also wouldn't hurt to check task manager and see if there is a glamour_server.exe sitting there.