[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Patch] Windows sockets version 2.2
[Thread Prev] | [Thread Next]
- Subject: Re: [Patch] Windows sockets version 2.2
- From: Chris Ruehl <chris.ruehl@xxxxxxxxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Thu, 8 Jun 2017 11:20:22 +0800
- To: libssh@xxxxxxxxxx
On Thursday, June 08, 2017 12:39 AM, Aris Adamantiadis wrote:
Hi Chris, Total noob here. Does winsock 2.2 change some semantics/fix some bugs from 2.0 we were used to see on windows? I'm thinking about WSAPoll that we had to stop supporting because it was so buggy. I don't understand this comment: + /* Validate version it can fallback to 2.0 */ If winsock 2.2 works on everything above 95, we don't really need a fallback anyway. I doubt libssh would run on 98 anyway. Aris On 7/06/17 07:37, Chris Ruehl wrote: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();
Aris, I get this information from the MSN page. The WASStartup() return 0 (success) as well if the system has 2.0 is availableonly, the version check is to be sure to deal with 2.2 - my sample reject a fallback to 2.0.
Chris -- GTSYS Limited RFID Technology 9/F, Unit E, R07, Kwai Shing Industrial Building Phase 2, 42-46 Tai Lin Pai Road, Kwai Chung, N.T., Hong Kong Tel (852) 9079 9521 Disclaimer: http://www.gtsys.com.hk/email/classified.html
[Patch] Windows sockets version 2.2 | Chris Ruehl <chris.ruehl@xxxxxxxxxxxx> |
Re: [Patch] Windows sockets version 2.2 | Aris Adamantiadis <aris@xxxxxxxxxxxx> |