I think
this was the class I used in the past.
I cannot find my modifications to the class for the receive time out
But there is a timeout used in the receive routine WaitForSingleObject(). I think I messed with this, I do not have Windows machine set up to try and reconstruct what I did. sorry I cannot be of more help.
Fortunately it has been a long time since I have had to program Windows.