On Windows, calling
The error is avoided by adding a
I wrote a sample able to always reproduce the issue:
The problem does not occur on Linux.
The text was updated successfully, but these errors were encountered:
After some investigations, here is my understanding.
On a spurious readable event, a call to
IMHO, spurious read/write events should never occur when the socket is not connected.
Moreover, it's not always easy to workaround: AFAIK, there is no sane way to detect whether a
I currently register it with writable interest, so that when I receive the writable event, I consider it is connected. It works on Linux, but this assumption is wrong on Windows, since we can (and we do) receive spurious writable events.
And there is no method
What do you think?
In my tests i get an error trying to read a socket that "failed to connect", this status should be indicated in the OVERLAPPED structure AFAIK. There should be status codes set as a result of a connection attempt otherwise the overlapped IO is still pending.
For a rejected connection attempt:
Or a dropped connection attempt:
For comparison a connected socket produces an overlapped structure like this