选择boost :: asio中的功能 [英] select functionality in boost::asio

查看:181
本文介绍了选择boost :: asio中的功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要为我的项目使用boost :: asio lib。但是它不是很明显哪个函数对应于从本地socket c lib的 select()。是在asio可用吗?

I am going to use boost::asio lib for my project. But it's not quite obvious which function is corresponding to select() from native socket c lib. Is that available in asio? Or we boost provides alternative to find out a socket is ready?

推荐答案

的高层设计, Boost.Asio 是基于 Proactor设计模式。因此,您不需要在 select 上轮询。相反,提交异步操作的完成处理程序,当操作完成时,调用完成处理程序。

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.

这篇关于选择boost :: asio中的功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆