I know that in order to call WSASend()
simultaneously, I need to provide for each call a unique WSAOVERLAPPED
and WSABUF
instances. But this means that I have to keep track of these instances for each call, which will complicate things.
I think it would be a better idea if I create a thread that only make WSASend()
calls not simultaneously but rather sequentially. This thread will wait on a queue that will hold WSASend()
requests (each request will contain the socket handle and the string I want to send). When I eventually call WSASend()
I will block the thread until I receive a wake up signal from the thread that waits on the completion port telling me that the WSASend()
has been completed, and then I go on to fetch the next request.
If this is a good idea, then how should I implement the queue and how to make a blocking fetch call on it (instead of using polling)?