Friday, May 23, 2008

Boost.Asio vs Asio

Sometimes I am asked what the difference is between the (non-Boost) Asio and Boost.Asio packages I provide. Here is the definitive word on the subject, presented as a series of questions and answers.

What are the differences in the source code?

— Asio is in a namespace called asio::, whereas Boost.Asio puts everything under boost::asio::.

— The main Asio header file is called asio.hpp. The corresponding header in Boost.Asio is boost/asio.hpp. All other headers are similarly changed.

— Any macros used by or defined in Asio are prefixed with ASIO_. In Boost.Asio they are prefixed with BOOST_ASIO_.

— Asio includes a class for launching threads, asio::thread. Boost.Asio does not include this class, to avoid overlap with the Boost.Thread library

— Boost.Asio uses the Boost.System library to provide support for error codes (boost::system::error_code and boost::system::system_error). Asio includes these under its own namespace (asio::error_code and asio::system_error). The Boost.System version of these classes currently supports better extensibility for user-defined error codes.

— Asio is header-file-only and for most uses does not require linking against any Boost library. Boost.Asio always requires that you link against the Boost.System library, and also against Boost.Thread if you want to launch threads using boost::thread.

Where do I get a release package?

Asio is available for download from sourceforge, in a package named asio-X.Y.Z.tar.gz (or .tar.bz2 or .zip).

Boost.Asio is included in the Boost 1.35 distribution. It is also available as a separate package on sourceforge, named boost_asio_X_Y_Z.tar.gz. The latter is intended to be copied over the top of an existing Boost source code distribution.

Where are the source code repositories?

Asio uses a sourceforge-hosted CVS repository. Details of how to access it may be found here. It may also be browsed via the web.

Boost.Asio is checked into Boost's subversion repository.

How do you maintain both versions?

All development is done in the Asio CVS repository. I periodically convert the source into Boost format using a script called boostify.pl, and merge the changes into the Boost subversion repository.

Will Asio be discontinued now that Boost.Asio is included with Boost?

No. There are projects using Asio and they will continue to be supported. I also prefer to use Asio over Boost.Asio in my own projects, for the convenience of header-file-only and shorter namespaces.

Should I use Asio or Boost.Asio?

It depends. Here are some things to consider:

— If you (like me) prefer the convenience of header-file-only libraries then I'd suggest using Asio over Boost.Asio.

— If you must use a version of Boost older than 1.35 then Boost.Asio is not included. You can use Boost.Asio by copying it over the top of your Boost distribution (see above), but not everyone is comfortable doing this. In that case, I would suggest using Asio over Boost.Asio.

— I will be creating new versions of both the Asio and Boost.Asio packages on a faster release cycle than that followed by Boost. If you want to use the latest features you can still use Boost.Asio as long as you are happy to copy it over the top of your Boost distribution. If you don't want to do this, use Asio rather than Boost.Asio.

Can Asio and Boost.Asio coexist in the same program?

Yes. Since they use different namespaces there should be no conflicts, although obviously the types themselves are not interchangeable. (In case you're wondering why you might want to do this, consider a situation where a program is using third party libraries that are also using Asio internally.)

18 comments:

Anonymous said...

Chris,

Can you get us an example code to do two-way Handshaking in ssl. The example code in boost.org has only server authentication. How to do both server and client authentication.

Thanks and Regards,
Brown

Andy Webber said...

It seems that think-async.com is down at this point. Are you removing support for the non-boost library?

Anna Schafer said...

We are offering an elo boost service for the game league of legends, so we help our customers to get an higher elo on this game by playiing with them or by playing on their account.elo boost

Unknown said...

I would but say to you all "impressive information" ELO Job

daren sammy said...

Recent times when net has so often gossip mongering and clog; your proportion really refreshes me. wp themes

Victor Vaden said...

Why hello there ?! A cheap but professional pay for essay writing service, has been offering essay writers for hire to busy and exhausted students since approximately 2017. There you could always count on a cheap service that can live up to all your expectations.

Bob Heist said...

Finest plus Least expensive Jabodetabek Personal Instruction, all of our workers in addition to educators can come home, arranged your very own analysis program and might pick out virtually any arena with review ... go to https://kursus-akuntansi.netlify.app/kursus-akuntansi-pejaten.html for more information

goldyyy said...

No matter what you are up to, a huge party your friend throws, a movie night or a date, you can have it all essay proofreader online. We’ll take care of your assignment.

Elmo Curro said...

Jabodetabek private tutoring services with teachers visiting the house. Above hundreds of active tutors are prepared to teach various skills and lessons for kids to adults ... visit https://kursus-jerman.vercel.app/kursus-bahasa-jerman-tangerang-selatan.html for more details

Guest said...

Wow! It's awesome. This is a great deal. see more

Jack Dowson said...

Retail applications utilized in-store reshape the shopping experience — from presenting shrewd mirrors in the fitting space to coordinating brilliant speakers and voice-enacted colleagues, as BevMo! stores in California do. The in-store shopping device, Savvy Walkway, urges customers to discuss their inclinations and recommends three items that are the ideal fit.

Another model is a skincare and magnificence store from Shanghai, that utilizes facial acknowledgment, man-made consciousness and intuitive skin investigation stations to assist shoppers with making buys easily>> retail software developer

Robin said...

Please stay us up to date like this. Thank you sharing. DUI Lawyer Dinwiddie VA

Jack said...

I'm sorry, but I do not have access to specific reviews from the website "blog.think-async" or any other specific sources beyond my last knowledge update in September 2021. If you're looking for reviews or information about a particular topic discussed on this website, I recommend visiting the website directly and using their search feature or navigating to the specific section of interest. Additionally, you can use search engines to find reviews or discussions about topics related to async programming or other subjects you're interested in.
abogado de flsa de jersey sur

Induja Jenifer said...

This article provides a comprehensive comparison of Boost.Asio and Asio, a asynchronous I/O library, providing a detailed overview of their key differences and considerations. The in-depth analysis helps developers make informed decisions based on their specific project requirements. The discussion on performance and compatibility highlights the advantages and limitations of each library, making it easier to choose the right one. As someone who has worked with both libraries, the review is insightful and well-researched, making it a valuable resource for developers seeking to harness the power of asynchronous I/O.
New York Divorce Property Division

jamesbarns said...

Salesforce AI Associate Salesforce-AI-Associate practice questions and answers for pre-exam evaluation. The practice exams Salesforce-AI-Associate , CRT-261 dumps questions contain study questions taken from the previous exams and are given with an answer key. If you spare time to solve these tests, they will benefit you a lot and maximize your prospects of success.

Angel17 said...

Such a nice post. Thanks for this one. brick masons near me

Anonymous said...

Great post comparing Boost.Asio and Asio. When working with such frameworks, especially in the context of high-performance applications, integrating strong cybersecurity practices is essential. The recent case involving Josh Baazov and Lachmi Sagi highlighted the critical need for secure coding practices to protect against vulnerabilities. For instance, ensuring that your asynchronous operations handle sensitive data properly can prevent breaches and enhance security. Check out this article for a detailed look at how cybersecurity measures can be applied https://cybersecuritynews.com/backstage-game-by-josh-baazov-sagi-lahmi/. Balancing efficiency with robust security will make our applications both powerful and safe.

John Fei said...

The article https://attractgroup.com/blog/8-key-characteristics-of-high-performing-team/ on the eight key characteristics of high-performing teams is a must-read for anyone looking to enhance team dynamics. It effectively highlights essential traits such as trust, clear communication, and shared goals, which are fundamental in fostering collaboration and productivity. The insights provided not only emphasize the importance of a supportive environment but also offer actionable tips that can be implemented to improve team performance. A valuable resource for leaders and team members alike!