TestErrors frees a port and then connects to it, expecting a refusal.
The connecting socket was bound after the port was freed, so the system
could give it that same port. On macOS it did (socktest-u, native-macos):
a socket connecting to its own address and port connects to itself, so
the connection succeeded. The connecting socket is now bound first, so
it holds a different port.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRRw4kkFHrrHRhkcuLw
Signed-off-by: Claude <noreply@anthropic.com>
The test cancels its blocking call on the second OnMessagePending. On
Linux and macOS a local connect may also wait for its notice, which
under load took that second call, so the connect was cancelled and the
receive then waited forever. Counting starts at the receive.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRRw4kkFHrrHRhkcuLw
Signed-off-by: Claude <noreply@anthropic.com>
A socket made with Socket(..., AF_INET6) takes IPv6 addresses and host
names in the string forms of Bind, Connect and SendTo. GetPeerNameEx,
GetSockNameEx, ReceiveFromEx and SendToEx take and give addresses of
either family. Host names go through getaddrinfo where ws2_32 has it
(Windows XP and later); numeric addresses work through
WSAStringToAddress everywhere. socktest covers the Ex functions on
IPv4, and IPv6 datagrams and a connection over ::1 where the system
has IPv6.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRUqfQ3sTcDCMdNCGGs
afxsock.h and sockcore.cpp. Each thread gets a hidden window that
Winsock posts socket events to; CAsyncSocket turns them into On...
calls. A CSocket call that would block waits for its own event on that
window, deferring the other socket events until it ends, and runs
OnMessagePending meanwhile; CancelBlockingCall stops it with WSAEINTR.
CSocketFile lets a CArchive read and write through a CSocket, and
CArchive no longer seeks back over read-ahead on such a file.
Also:
- AfxSocketInit and AfxEnableControlContainer move to afxsock.h and
afxdisp.h with MFC's signatures. The old afxwin.h declarations made
AfxEnableControlContainer() ambiguous once afxdisp.h was included.
- afx.h includes the headers a WIN32_LEAN_AND_MEAN windows.h leaves
out, so programs that define it build.
- Console tests are now any test without a .rc file.
tests/socktest covers it over the loopback interface.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRUqfQ3sTcDCMdNCGGs