dimanche 22 février 2015

How to send data when using Overlapped I/O with Completion Routine? [duplicate]


This question already has an answer here:




When I want to use WSASend(), I must provide a callback function (Completion Routine) that will be called by the system to inform me that the data has been sent.


But the problem is in order for the callback function to be called, the thread that calls WSASend() must be in a wait state, and I want to call WSASend() from the UI thread, so the UI would freeze in this case!


How can I fix this problem, should I create another thread that will call WSASend(), and when I want to send data from the UI thread, I should "tell" the other thread that I want to send, and give it the buffer to send?


Aucun commentaire:

Enregistrer un commentaire