I'm writing a program that handles lots of tcp connections. Both
outbound and inbound. I'm using a single thread to handle the IO on
these sockets so, after looking around on MSDN, I decided to use
WSASend and WSARecv as they support OVERLAPPED IO. Now I wrote a first
function that uses WSASend to send bytes over sockets. As written on
the docs sometimes it returns 0, in that situation I've the bytes send
in a int that i give as an argument to the function. As predicted if I
put a big buffer in it, it will return the WSA_IO_PENDING error that,
as the docs say, means that the completion routine will be called. Now
the problem is that in the latter situation the completion routine is
not called at all. I receive correctly the WSA_IO_PENDING, but I don't
receive a call. Data flows to the client, as I can see it, but I don't
get the routine called at all. I noticed this because it doesn't touch
a breakpoint I put at the beginning of the routine and it doesn't
print a cout too. Did I misunderstood the semantics of this function?
What may be the reasons for this?

Moreover I've another doubt: will this function be called even if
WSASend didn't return WSA_IO_PENDING?? I read it somewhere in the docs
but I can't find it again (sorry...).