For non-blocking calls you need to use
CAsyncSocket
instead. Blocking is explained here:
http://msdn.microsoft.com/en-us/library/3tbz7kf5%28v=vs.100%29.aspx[
^].
I would advise to use
CSocket
and blocking calls with threads. Do all networking in separate threads. I think asynchronous APIs were offered when threads were not a commonplace and presently does not make a lot of sense. Threaded solutions are more straightforward, and the role of asynchronous callbacks, etc are played by thread communication primitives which are more explicit and give you more control.
—SA