From b819dd46b2fd8dc600c3547e1d30e7e988dc6132 Mon Sep 17 00:00:00 2001 From: Ari Johnson Date: Fri, 23 Feb 2007 02:52:27 +0000 Subject: [PATCH] Win32 compatibility fixes --- src/bsd.c | 9 +++++++++ 1 file changed, 9 insertions(+) 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; -- 2.30.2