开发者

Multiple immediate number of WSASend calls and the data sending order

开发者 https://www.devze.com 2023-04-10 18:49 出处:网络
As you know, WSASend-completion-WSASend-...(repeat) guarantees sending data in order. However, I heard that WSASend-WSASend-WSASend-completion-completion-completion ALSO GUARANTEES sending data in ord

As you know, WSASend-completion-WSASend-...(repeat) guarantees sending data in order. However, I heard that WSASend-WSASend-WSASend-completion-completion-completion ALSO GUARANTEES sending data in order, although the o开发者_如何学JAVArder of completion does not. Is that right?

Please reply. Thanks in advance.

Hyunjik Bae


If there are multiple requests queued up at a time, their data is sent in the order that they are queued, and their completion routines are queued up in the same order as well. The second send does not occur until the first send completes, the third send after the second send completes, etc. However, if you have multiple threads processing the completions, it is possible to have the completions being processed in parallel, which can get out of order depending on context switches and such. That's why you need to associate an identifying value with each pending request so you can match it with its completion regardless of the order, and don't have multiple requests pending for sending portions of the same resource.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号