Use of Winsock 2.0 instead of 2.2?

42 views
Skip to first unread message

Mark Rotteveel

unread,
Apr 14, 2025, 3:26:19 AMApr 14
to firebir...@googlegroups.com
Going over the code of inet.cpp, I noticed

```
static WSADATA wsadata;
const WORD version = MAKEWORD(2, 0);
const int wsaError = WSAStartup(version, &wsadata);
```

In other words, we're asking for Winsock 2.0, while, since at least
1996, the version is Winsock 2.2 (would be MAKEWORD(2,2)).

From
https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-wsastartup:
(emphasis mine)

"""
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**.
"""

(Apparently, they haven't updated this to mention Windows versions
released after that.)

Going over the 2.2.0 spec (at https://archive.org/details/Winsock2Spec),
I didn't see anything that would change for us by asking for 2.2, but it
would make sense to me to ask for version 2.2 as recommended by Microsoft.

Also, it shouldn't be necessary for wsadata to be declared static, as it
is just to inform you of the result, and we don't do anything with it later.

Mark
--
Mark Rotteveel

Mark Rotteveel

unread,
Apr 17, 2025, 2:29:24 AMApr 17
to firebir...@googlegroups.com
Any objections if I just change it to MAKEWORD(2, 2)?

Mark

Vlad Khorsun

unread,
Apr 17, 2025, 3:23:16 AMApr 17
to firebir...@googlegroups.com
Any objections if I just change it to MAKEWORD(2, 2)?

  Lets do it.

Regards,
Vlad

Mark Rotteveel

unread,
Apr 17, 2025, 3:31:06 AMApr 17
to firebir...@googlegroups.com
On 17/04/2025 09:23, Vlad Khorsun wrote:
> Any objections if I just change it to MAKEWORD(2, 2)?
>
>
>   Lets do it.

OK, done.

Mark
--
Mark Rotteveel
Reply all
Reply to author
Forward
0 new messages