gm_bromsock
gm_bromsock copied to clipboard
Sockets are being left in CLOSE-WAIT in unix
Check socket statuses using ss | grep "<port>"
. I can connect and send messages fine, and then disconnect, but sometimes or always the client doesn't properly close and gets stuck in a CLOSE-WAIT state.
This can cause big issues because the port can become occupied forever until srcds closes and thus the socket server can't restart if needed.
The way I found to combat this is to, before closing from the client end, send a message like "disconnect" to the server, which the server sees and closes the client socket serverside. After the client sends the disconnect message, it also calls Close on itself.
Saw something about clients having to send a 'FIN' message to the server before closing, is that being done properly?
Same problem I'm pretty sure. If it's setup as autorun, it will only successfully bind to the target port after I completely restart my server.. I even tried creating a timer to try listen up to 10 times, 10 seconds apart. No luck