2010-03-25 14:04:01 UTC
we are developing a network application using IO Completion Ports.
We issue asynchronous read operations on a socket with "ReadFile" and get
the result via GetQueuedCompletionStatus.
There are two situation, where we can see what happens (via debugging), but
I can not figure out, where this behaviour is documented.
Maybe you can shed some light on the two issues:
There is an open socket/handle and a asynchronous ReadFile was issued on
1) If locally "closesocket" is called, GetQueuedCompletionStatus (for the
ReadFile operation) returns with "false" and
GetLastError returns ERROR_OPERATION_ABORTED (995).
This makes sense, but this is nowhere documented.
2) If the remote partner is closing the socket, GetQueuedCompletionStatus
return with "true", numberOfBytesTransferred is 0.
(If I continue to issue another "ReadFile" also this operation returns
"true" and numberOfBytesTransferred=0.)
It looks like this is the indication that the socket was closed. Also this
is nowhere documented.
Are there other ways to detect, that the socket was closed by the remote
I would appreciate, if somebody can confirm these observations and if
somebody can point out where this behaviour is documented.
Thanks for your help,