No, I don't have. I meant If I receive more than 10 packets in one second from peer (with single outstanding WSARecv), I want to close socket hard immediately.
My question is this:
Are you trying to receive from the same socket at the same time from more than one thread?
If so, how do you synchronize two threads getting messages from the same socket at the same time?
If not, if you only use one particular thread to get the queued completion status from a particular socket (or only have one request outstanding at a time,) then sequencing the code so that you don't issue a new asynchronous request when you decide to close the socket is easy.
Separately, if you have more than one outstanding asynchronous request, then you already have to solve this problem, because two of them could complete at the same time.