I noticed that when I call closesocket, the completion routine of WSARecvFrom (which by that time waits for incoming data) is being triggered with dwError=0 and cbTransferred=garbage, eve though there is no incoming data pending for that socket.
Any way for it not to be called when i close the socket? I tried to call shutdown prior to closesocket, but it didn't help.