Sign in to follow this  
bulgurmayo

experience with boost::ASIO

Recommended Posts

bulgurmayo    114
While reading the Multiplayer and Network Programming FAQ, I stumbled across the existence of boost::ASIO, which I am now considering to use. Has any of you some experience with this library ? Is it worth the dive ?

Share this post


Link to post
Share on other sites
Sneftel    1788
It's a complicated and confusing library. If you have need of asynchronous networking stuff, it's more cross-platform and easier to program than, say, IOCP. Otherwise you won't be interested.

Share this post


Link to post
Share on other sites
Antheus    2409
If you can stomach the template meta-programming (it's completely templated), then it's fine.

Also bear in mind that, while being network IO library, it's a complete asynchronous programming toolkit. All programming is based on reactor and pro-actor patterns internally, implemented with lock-less primitives. Explicit synchronization is available with software implementation of fibers (called strands).

While toying around with it, I managed to replicate the stackless Python functionality in no time. Performance-wise it's decent. While a few extra cycles could be squeezed out of it, the out-of-box implementation is essentially the same as raw IOCP, but with usual boost-like reobustness.

Due to heavy reliance on function pointers it may benefit from recently improvements to Boost, but I haven't tested that yet.

I'm also using non-boost version, which is essentially the same, but has a tad simpler namespace.

If you're comfortable with traits, and designing application solely on templated classes, then ASIO will provide just the most optimal code you can think of. You can obviously use more conservative inheritance models to wrap access.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this