[Xcb] [PATCH 3/3] Use WSAStartup()/WSACleanup() on WIN32

Jon TURNEY jon.turney at dronecode.org.uk
Fri Jan 6 09:12:19 PST 2012

On 06/01/2012 03:38, Josh Triplett wrote:
> On Thu, Jan 05, 2012 at 04:29:47PM -0600, Ryan Pavlik wrote:
>> On Thu, Jan 5, 2012 at 3:28 PM, Josh Triplett <josh at joshtriplett.org> wrote:
>>> On Thu, Jan 05, 2012 at 08:57:54PM +0000, Jon TURNEY wrote:
>>> What happens if the application using XCB has already called WSAStartup,
>>> and passes a lower version number than 2.2?  Will XCB's call to
>>> WSAStartup cause Winsock to start assuming 2.2 semantics instead of
>>> whatever older semantics the application requested?  Or will Winsock
>>> just tell XCB to use the older version?  In the latter case, can XCB
>>> live with that?
>> I'm not sure, but 2.2 is available since a patch for Windows 95, so I'm
>> pretty confident that it's a safe alternative.
> I definitely don't care about the case where the system has an older
> Winsock; I just wondered what would happen if the application using XCB
> called WSAStartup first, with a lower version number.

This is an excellent question.  Unfortunately, I can't find an answer in MSDN,
and it seems nobody knows (or at least google doesn't know :-)).

Practically, I'm not sure that this is much of an issue.  At this point in
time, Winsock versions seem to be of historical interest only.

* The MSDN specification for WSAStartup() [1] seems to say that new
applications targeting anything since Win95 OSR2 should request 2.2.  I don't
think there can be any old (circa 2002, EOL for Win95) applications using
libxcb on Win32?

* I would guess that the set of Win32 applications which use libxcb *AND* use
Winsock sockets directly is pretty small, maybe even empty :-)

I would suggest this is fixed by documenting that if your application calls
WSAStartup(), it should ask for version 2.2.

(I note that [2] doesn't explicitly say what version you are supposed to
supply to WSAStartup(), so if the version does actually make a difference to
the socket semantics used by xcb, there is a problem already)

[1] http://msdn.microsoft.com/en-us/library/ms742213
[2] http://xcb.freedesktop.org/win32port/

More information about the Xcb mailing list