Select functionality in boost::asio

我只是一个虾纸丫 提交于 2019-12-01 15:27:37

The high-level design of Boost.Asio is based on the Proactor desing pattern. Thus, you don't need to poll on select. Instead, submit your completion handler for an asynchronous operation, and when the operation gets completed - the completion handler gets called.

The documentation has a specific section for mapping the BSD socket API calls into their respective Asio equivalent

poll(), select(), pselect()

io_service::run(), io_service::run_one(), io_service::poll(), io_service::poll_one()

Note: in conjunction with asynchronous operations.

Note that there are subtle differences between each of these io_service methods, picking the correct one will depend on your application design.

Ishan Arora

Boost.Asio does provide a select like functionality using null_buffers. https://stackoverflow.com/a/4686523/1134207 explains more.

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