Say that I have two programs, a client and a server, and that I am running the client and the server on the same computer (so the speed is extremely fast), and say that the client socket's receive buffer is empty, and that the server will not send any data to the client except if the client told the server to do so.
Now in the client, I call WSASend()
and then after it I call WSARecv()
:
WSASend(...); // tell the server to send me some data
WSARecv(...);
So in the code above, WSASend()
is telling the server to send some data to the client (for example: the string "hello"
).
Now after some time, two completion packets will be placed in the completion port:
The first completion packet is for
WSASend()
(telling me that the data has been placed in the client socket's send buffer).The second completion packet is for
WSARecv()
(telling me that the data has been placed in the buffer that I passed toWSARecv()
when I called it).
Now my question is: is it possible that the completion packet for WSARecv()
be placed in the completion port before the completion packet for WSASend()
(so when I call GetQueuedCompletionStatus()
I will get the completion packet for WSARecv()
first)?