4fbc4e3be9
* init Net system on Windows * propagate DNS error * Add zlib 1.2.11 sources * link zlib statically for windows * remove not implemented function declaration * fix connect on Windows
40 lines
668 B
C++
40 lines
668 B
C++
/*
|
|
* IXNetSystem.cpp
|
|
* Author: Benjamin Sergeant
|
|
* Copyright (c) 2019 Machine Zone. All rights reserved.
|
|
*/
|
|
|
|
#include "IXNetSystem.h"
|
|
|
|
namespace ix
|
|
{
|
|
bool initNetSystem()
|
|
{
|
|
#ifdef _WIN32
|
|
WORD wVersionRequested;
|
|
WSADATA wsaData;
|
|
int err;
|
|
|
|
/* Use the MAKEWORD(lowbyte, highbyte) macro declared in Windef.h */
|
|
wVersionRequested = MAKEWORD(2, 2);
|
|
|
|
err = WSAStartup(wVersionRequested, &wsaData);
|
|
|
|
return err == 0;
|
|
#else
|
|
return true;
|
|
#endif
|
|
}
|
|
|
|
bool uninitNetSystem()
|
|
{
|
|
#ifdef _WIN32
|
|
int err = WSACleanup();
|
|
|
|
return err == 0;
|
|
#else
|
|
return true;
|
|
#endif
|
|
}
|
|
}
|