Yes, that's great.
a WSAConnect call will block the thread until a connection is made / an error has occurred. then you can do asynchronous I / O and get notified of completed packages with your IOCP application. IOCP will not forward any packets regarding WSAConnect .
Another point is that IOCP works exclusively with Overlapped IO. if your function does not consume OVERLAPPED struct memory OVERLAPPED (e.g. WSAConnect ), you can be sure that IOCP will not deal with this API call. even if OVERLAPPED supplied, this does not mean that the action is asynchronous and will be published in IOCP.
you can take a look at Boost.Asio for C ++ and libuv for C. The code will also be portable (and less complicated). another interesting platform is microsoft Casablanca , which is cross-platform, but in my experience, performance is disastrous.
source share