- attempt to fix WSAStartup error message on win32

This commit is contained in:
Mark Vejvoda 2011-01-17 21:31:59 +00:00
parent c51eb0a3c4
commit d8e28fbf90
3 changed files with 17 additions and 16 deletions

View File

@ -1379,6 +1379,10 @@ int glestMain(int argc, char** argv) {
disableBacktrace = true; disableBacktrace = true;
} }
#ifdef WIN32
SocketManager winSockManager;
#endif
bool haveSpecialOutputCommandLineOption = false; bool haveSpecialOutputCommandLineOption = false;
if( hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_OPENGL_INFO]) == true || if( hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_OPENGL_INFO]) == true ||

View File

@ -92,23 +92,20 @@ public:
// class Socket // class Socket
// ===================================================== // =====================================================
class Socket : public SimpleTaskCallbackInterface {
#ifdef WIN32 #ifdef WIN32
class SocketManager{
private: public:
class SocketManager{ SocketManager();
public: ~SocketManager();
SocketManager(); };
~SocketManager();
};
protected:
static SocketManager socketManager;
#endif #endif
class Socket : public SimpleTaskCallbackInterface {
protected: protected:
#ifdef WIN32
SocketManager wsaManager;
#endif
PLATFORM_SOCKET sock; PLATFORM_SOCKET sock;
time_t lastDebugEvent; time_t lastDebugEvent;
static int broadcast_portno; static int broadcast_portno;

View File

@ -214,9 +214,9 @@ bool UPNP_Tools::enabledUPNP = false;
return acErrorBuffer; return acErrorBuffer;
} }
Socket::SocketManager Socket::socketManager; //SocketManager Socket::socketManager;
Socket::SocketManager::SocketManager(){ SocketManager::SocketManager() {
WSADATA wsaData; WSADATA wsaData;
WORD wVersionRequested = MAKEWORD(2, 0); WORD wVersionRequested = MAKEWORD(2, 0);
WSAStartup(wVersionRequested, &wsaData); WSAStartup(wVersionRequested, &wsaData);
@ -224,7 +224,7 @@ bool UPNP_Tools::enabledUPNP = false;
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"Winsock initialized.\n"); SystemFlags::OutputDebug(SystemFlags::debugNetwork,"Winsock initialized.\n");
} }
Socket::SocketManager::~SocketManager(){ SocketManager::~SocketManager() {
WSACleanup(); WSACleanup();
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"Winsock cleanup complete.\n"); SystemFlags::OutputDebug(SystemFlags::debugNetwork,"Winsock cleanup complete.\n");
} }