Re: #15562: Use ws2_32.dll (Winsock 2) instead of the ancient wsock32.dll (Winsock 1.1)

132 views
Skip to first unread message

wxTrac

unread,
Apr 18, 2021, 7:34:35 AM4/18/21
to wx-...@googlegroups.com
#15562: Use ws2_32.dll (Winsock 2) instead of the ancient wsock32.dll (Winsock 1.1)
------------------------+---------------------------------------------
Reporter: justinian | Owner:
Type: defect | Status: confirmed
Priority: normal | Milestone: 3.1.6
Component: wxMSW | Version: stable-latest
Resolution: | Keywords: winsock winsock2 pragma linking
Blocked By: | Blocking:
Patch: 1 |
------------------------+---------------------------------------------
Changes (by vadz):

* milestone: 3.2.0 => 3.1.6


Comment:

Let's try changing this for 3.1.6, finally, and see if it creates any
problems.

--
Ticket URL: <https://trac.wxwidgets.org/ticket/15562#comment:8>

wxTrac

unread,
Apr 18, 2021, 4:23:27 PM4/18/21
to wx-...@googlegroups.com
#15562: Use ws2_32.dll (Winsock 2) instead of the ancient wsock32.dll (Winsock 1.1)
------------------------+---------------------------------------------
Reporter: justinian | Owner:
Type: defect | Status: confirmed
Priority: normal | Milestone: 3.1.6
Component: wxMSW | Version: stable-latest
Resolution: | Keywords: winsock winsock2 pragma linking
Blocked By: | Blocking:
Patch: 1 |
------------------------+---------------------------------------------

Comment (by vadz):

Checking if it works in [https://github.com/wxWidgets/wxWidgets/pull/2335
PR 2335].

If it does, I think we should also set `wxUSE_WINSOCK2` to 1 by default.

--
Ticket URL: <https://trac.wxwidgets.org/ticket/15562#comment:9>

wxTrac

unread,
Apr 18, 2021, 4:38:04 PM4/18/21
to wx-...@googlegroups.com
#15562: Use ws2_32.dll (Winsock 2) instead of the ancient wsock32.dll (Winsock 1.1)
------------------------+---------------------------------------------
Reporter: justinian | Owner:
Type: defect | Status: confirmed
Priority: normal | Milestone: 3.1.6
Component: wxMSW | Version: stable-latest
Resolution: | Keywords: winsock winsock2 pragma linking
Blocked By: | Blocking:
Patch: 1 |
------------------------+---------------------------------------------
Changes (by NewPagodi):

* cc: m0081@… (added)


Comment:

The winsock SocketPoller I wrote for wxWebSessionCURL on windows uses
WSAAsyncSelect which is deprecated in winsock2.

Right now I don't see a good way to write a socket poller in winsock2
other than to use WSAWaitForMultipleEvents in a worker thread. And since
WSAWaitForMultipleEvents has a 64 socket limit, I guess the socket poller
would need to use as many threads as necessary.

From what I understand, Microsoft wants people to use overlapped IO and
use functions like [WSARecv](https://docs.microsoft.com/en-
us/windows/win32/api/winsock2/nf-winsock2-wsarecv) to do the reads
asynchronously. But that's not really something we can do since we want
libcurl to do the actual reading/writing. We just want to monitor the
socket so we know when to tell it to do that.

Does anyone know of a good way to monitor a socket to see when it is ready
for activity in winsock2.

--
Ticket URL: <https://trac.wxwidgets.org/ticket/15562#comment:10>

wxTrac

unread,
Apr 18, 2021, 6:04:30 PM4/18/21
to wx-...@googlegroups.com
#15562: Use ws2_32.dll (Winsock 2) instead of the ancient wsock32.dll (Winsock 1.1)
------------------------+---------------------------------------------
Reporter: justinian | Owner:
Type: defect | Status: confirmed
Priority: normal | Milestone: 3.1.6
Component: wxMSW | Version: stable-latest
Resolution: | Keywords: winsock winsock2 pragma linking
Blocked By: | Blocking:
Patch: 1 |
------------------------+---------------------------------------------

Comment (by vadz):

I thought Winsock 2 was backwards-compatible with Winsock 1.1, are you use
`WSAAsyncSelect()` doesn't work in the former?

--
Ticket URL: <https://trac.wxwidgets.org/ticket/15562#comment:11>

wxTrac

unread,
Apr 18, 2021, 6:37:43 PM4/18/21
to wx-...@googlegroups.com
#15562: Use ws2_32.dll (Winsock 2) instead of the ancient wsock32.dll (Winsock 1.1)
------------------------+---------------------------------------------
Reporter: justinian | Owner:
Type: defect | Status: confirmed
Priority: normal | Milestone: 3.1.6
Component: wxMSW | Version: stable-latest
Resolution: | Keywords: winsock winsock2 pragma linking
Blocked By: | Blocking:
Patch: 1 |
------------------------+---------------------------------------------
Changes (by NewPagodi):

* cc: m0081@… (removed)


Comment:

The socket poller works with winsock2 but there will be a deprecation
warning at compile time.

The documentation for [https://docs.microsoft.com/en-
us/windows/win32/api/winsock/nf-winsock-wsaasyncselect WSAAsyncSelect]
also contains this ominous sounding warning:

[The WSAAsyncSelect function is available for use in the operating
systems specified in the Requirements section. It may be altered or
unavailable in subsequent versions. Rather than use Select-style I/O, use
Overlapped I/O and Event Objects with WinSock2.]

There will probably be few if any people using the curl backend on windows
so its probably not a big issue.

--
Ticket URL: <https://trac.wxwidgets.org/ticket/15562#comment:12>

wxTrac

unread,
Apr 18, 2021, 6:40:03 PM4/18/21
to wx-...@googlegroups.com
#15562: Use ws2_32.dll (Winsock 2) instead of the ancient wsock32.dll (Winsock 1.1)
------------------------+---------------------------------------------
Reporter: justinian | Owner:
Type: defect | Status: confirmed
Priority: normal | Milestone: 3.1.6
Component: wxMSW | Version: stable-latest
Resolution: | Keywords: winsock winsock2 pragma linking
Blocked By: | Blocking:
Patch: 1 |
------------------------+---------------------------------------------

Comment (by vadz):

Replying to [comment:12 NewPagodi]:
> The socket poller works with winsock2 but there will be a deprecation
warning at compile time.

We should just suppress it.

> The documentation for [https://docs.microsoft.com/en-
us/windows/win32/api/winsock/nf-winsock-wsaasyncselect WSAAsyncSelect]
also contains this ominous sounding warning:

I absolutely don't believe they're going to change it now if they haven't
done it since 1994.

--
Ticket URL: <https://trac.wxwidgets.org/ticket/15562#comment:13>

wxTrac

unread,
Apr 26, 2021, 10:12:21 AM4/26/21
to wx-...@googlegroups.com
#15562: Use ws2_32.dll (Winsock 2) instead of the ancient wsock32.dll (Winsock 1.1)
------------------------+---------------------------------------------
Reporter: justinian | Owner:
Type: defect | Status: confirmed
Priority: normal | Milestone: 3.1.6
Component: wxMSW | Version: stable-latest
Resolution: | Keywords: winsock winsock2 pragma linking
Blocked By: | Blocking:
Patch: 1 |
------------------------+---------------------------------------------

Comment (by Vadim Zeitlin <vadim@…>):

In [changeset:"1dfc18a004e6ac2d2b2b7b000ecdb1b2020d7f9e/git-wxWidgets"
1dfc18a00/git-wxWidgets]:
{{{
#!CommitTicketReference repository="git-wxWidgets"
revision="1dfc18a004e6ac2d2b2b7b000ecdb1b2020d7f9e"
Link with ws2_32.lib rather than obsolete wsock32.lib

Winsock 2 provided by ws2_32.lib is available since 1994, it should be
fine to use it even for wx in 2021.

See #15562.
}}}

--
Ticket URL: <https://trac.wxwidgets.org/ticket/15562#comment:14>

wxTrac

unread,
Apr 26, 2021, 10:12:22 AM4/26/21
to wx-...@googlegroups.com
#15562: Use ws2_32.dll (Winsock 2) instead of the ancient wsock32.dll (Winsock 1.1)
------------------------+---------------------------------------------
Reporter: justinian | Owner: Vadim Zeitlin <vadim@…>
Type: defect | Status: closed
Priority: normal | Milestone: 3.1.6
Component: wxMSW | Version: stable-latest
Resolution: fixed | Keywords: winsock winsock2 pragma linking
Blocked By: | Blocking:
Patch: 1 |
------------------------+---------------------------------------------
Changes (by Vadim Zeitlin <vadim@…>):

* owner: => Vadim Zeitlin <vadim@…>
* status: confirmed => closed
* resolution: => fixed


Comment:

In [changeset:"86d1a25624b0a3d34005a57bd299061560cc933c/git-wxWidgets"
86d1a2562/git-wxWidgets]:
{{{
#!CommitTicketReference repository="git-wxWidgets"
revision="86d1a25624b0a3d34005a57bd299061560cc933c"
Merge branch 'winsock-2'

Use WinSock 2 rather than 1.1 by default and also enable IPv6 support,
requiring WinSock 2, by default now that it can be done.

See https://github.com/wxWidgets/wxWidgets/pull/2335

Closes #15562.
}}}

--
Ticket URL: <https://trac.wxwidgets.org/ticket/15562#comment:15>
Reply all
Reply to author
Forward
0 new messages