//Closes the main tcp socket with the server, and clears the variable
if(global.s_tcpsocket > -1)
{
    closesocket(global.s_tcpsocket);
    global.s_tcpsocket = -1;
}