Is it thread safe to call async_send and async_receive at the same time?

▼魔方 西西 提交于 2019-12-06 05:39:28

This has to be OK. How else would you perform full duplex async communications on a single service? You need a receive outstanding at all times for incoming data.

The Boost docs indicate only that each of async_read and async_write must be called serially. For example, for async_read:

The program must ensure that the stream performs no other read operations (such as async_read, the stream's async_read_some function, or any other composed operations that perform reads) until this operation completes.

The docs for socket are not specific on this point, it's true.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!