Calling WSAGetLastError() from an IOCP thread return incorrect result
问题 I have called WSARecv() which returned WSA_IO_PENDING . I have then sent an RST packet from the other end. The GetQueuedCompletionStatus() function which exists in another thread has returned FALSE as expected, but when I called WSAGetLastError() I got 64 instead of WSAECONNRESET . So why WSAGetLastError() did not return WSAECONNRESET ? Edit: I forgot to mention that when I call WSAGetLastError() directly after a failing WSARecv() (because of an RST packet being received), the error code