From: Ari Johnson Date: Fri, 23 Feb 2007 02:52:27 +0000 (+0000) Subject: Win32 compatibility fixes X-Git-Tag: 0.73~114 X-Git-Url: https://git.theari.com/?a=commitdiff_plain;h=b819dd46b2fd8dc600c3547e1d30e7e988dc6132;p=cobramush.git Win32 compatibility fixes --- diff --git a/src/bsd.c b/src/bsd.c index 391b045..829ec54 100644 --- a/src/bsd.c +++ b/src/bsd.c @@ -4898,6 +4898,8 @@ how_many_fds(void) static int open_max = 0; #ifdef WIN32 int iMaxSocketsAllowed; + unsigned short wVersionRequested = MAKEWORD(1, 1); + int err; #endif if (open_max) return open_max; @@ -4914,6 +4916,13 @@ how_many_fds(void) * wsadata.iMaxSockets isn't valid for WinSock versions 2.0 * and later, but we are requesting version 1.1, so it's valid. */ + + /* Need to init Windows Sockets to get socket data */ + err = WSAStartup(wVersionRequested, &wsadata); + if (err) { + printf(T("Error %i on WSAStartup\n"), err); + exit(1); + } iMaxSocketsAllowed = options.max_logins ? (2 * options.max_logins) : 120; if (wsadata.iMaxSockets < iMaxSocketsAllowed) iMaxSocketsAllowed = wsadata.iMaxSockets;