[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Patch] Windows sockets version 2.2


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();
>
>



Follow-Ups:
Re: [Patch] Windows sockets version 2.2Chris Ruehl <chris.ruehl@xxxxxxxxxxxx>
Re: [Patch] Windows sockets version 2.2Chris Ruehl <chris.ruehl@xxxxxxxxxxxx>
References:
[Patch] Windows sockets version 2.2Chris Ruehl <chris.ruehl@xxxxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org