Don't try operating on a closed socket
Previously, in AddToMasterServer, which is called every two minutes to add the server to the master server's listing; the socket was assumed to already be open. It is then selected and if the select call fails, the socket is reconnected. Now for my theory on why this works on Windows, but not on linux after a file has been added. On linux, sockets are file descriptors, and new file descriptors open in increasing order. So when you open a file, the next file descriptor is used for that file. Because the socket was the lastly opened file descriptor and is now closed, that socket's closed file descriptor would be used. Selecting the socket before adding a file yields EBADF, the expected result. However, selecting it afterward yields a timeout. This leads me to believe that the file descriptor is actually still in use at that point, but simply not readable. I don't know enough about Windows to even guess why there is no problem there. But it must be that selecting this socket yields an error every time, regardless of other files that you open.