Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use boost::asio to abstract file descriptors?

Is there a tutorial on how to use the Boost::asio abstractions to multiple Linux file descriptors?

I'm basically looking for better abstractions to select on multiple file descriptors on a separate thread, with timeouts.

like image 325
zer0stimulus Avatar asked Oct 21 '25 00:10

zer0stimulus


1 Answers

Not a tutorial but a working example:

http://article.gmane.org/gmane.comp.lib.boost.asio.user/2699 or http://lists.boost.org/Archives/boost/2008/10/143892.php

They basically use boost::asio::posix::stream_descriptor to use native file descriptors with ASIO.

In the boost documentation there is also an example: POSIX-specific chat client demonstrates how to use the posix::stream_descriptor class to perform console input and output

And perhaps you want to use a reactor style io_service.

like image 149
rve Avatar answered Oct 23 '25 14:10

rve



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!