diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2013-04-28 08:51:49 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2013-04-28 08:54:27 +0200 |
commit | d23fa49c52e9e0310f938379c5af91f0b4e5fe46 (patch) | |
tree | fd2fe1116c25426ae657e99c2740200584b40256 /src/init.cpp | |
parent | 85157ae0183ca0efd36608b225b5c59ba8885cb9 (diff) |
move WSAStartup to init
WSAStartup should be called before using any other socket
functions. BindListenPort is not called if not listening.
Closes #2585.
Diffstat (limited to 'src/init.cpp')
-rw-r--r-- | src/init.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/init.cpp b/src/init.cpp index f6485c3b1d..7024f3f785 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -453,6 +453,14 @@ bool AppInit2(boost::thread_group& threadGroup) typedef BOOL (WINAPI *PSETPROCDEPPOL)(DWORD); PSETPROCDEPPOL setProcDEPPol = (PSETPROCDEPPOL)GetProcAddress(GetModuleHandleA("Kernel32.dll"), "SetProcessDEPPolicy"); if (setProcDEPPol != NULL) setProcDEPPol(PROCESS_DEP_ENABLE); + + // Initialize Windows Sockets + WSADATA wsadata; + int ret = WSAStartup(MAKEWORD(2,2), &wsadata); + if (ret != NO_ERROR) + { + return InitError(strprintf("Error: TCP/IP socket library failed to start (WSAStartup returned error %d)", ret)); + } #endif #ifndef WIN32 umask(077); |