[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Patch] Windows sockets version 2.2
[Thread Prev] | [Thread Next]
- Subject: [Patch] Windows sockets version 2.2
- From: Chris Ruehl <chris.ruehl@xxxxxxxxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Wed, 7 Jun 2017 13:37:18 +0800
- To: libssh@xxxxxxxxxx
Window Sockets 2.2 is the recommended DLL version, this patch change from v2.0 to v2.2 and add fallback check.Windows Sockets version 2.2 is supported on Windows Server 2008, Windows Vista, Windows Server 2003, Windows XP, Windows 2000, Windows NT 4.0 with Service Pack 4 (SP4) and later, Windows Me, Windows 98, and Windows 95 OSR2. Windows Sockets version 2.2 is also supported on Windows 95 with the Windows Socket 2 Update. Applications on these platforms should normally request Winsock 2.2 by setting the wVersionRequested parameter accordingly.
diff --git a/src/socket.c b/src/socket.c index 022c9a76..372b669a 100644 --- a/src/socket.c +++ b/src/socket.c @@ -107,10 +107,15 @@ int ssh_socket_init(void) { struct WSAData wsaData; /* Initiates use of the Winsock DLL by a process. */ - if (WSAStartup(MAKEWORD(2, 0), &wsaData) != 0) { + /* Winsock v2.2 */ + if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0) { + return -1; + } + /* Validate version it can fallback to 2.0 */ + if (LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 2) { + WSACleanup(); return -1; } - #endif ssh_poll_init();
Re: [Patch] Windows sockets version 2.2 | Andreas Schneider <asn@xxxxxxxxxxxxxx> |
Re: [Patch] Windows sockets version 2.2 | Aris Adamantiadis <aris@xxxxxxxxxxxx> |