C++ Boost:asio 的最佳文档?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/244453/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 14:01:17  来源:igfitidea点击:

Best documentation for Boost:asio?

c++boostboost-asio

提问by mmocny

The documentation available on the boost websiteis... limited.

boost 网站上提供的文档是……有限的。

From what I've been able to read, the general consensus is that it is simply difficult to find good documentation on the boost::asio library.

从我所读到的内容来看,普遍的共识是很难找到关于 boost::asio 库的好的文档。

Is this really the case? If so, why?

真的是这样吗?如果是这样,为什么?

Notes:

笔记:

  • I have already found the (non-boost) Asio website- and the documentation looks to be identical to that on the boost website.
  • I know that Boost::asio is new! I'm looking for solutions not excuses.
  • 我已经找到了(非 boost)Asio 网站- 并且文档看起来与 boost 网站上的相同。
  • 我知道 Boost::asio 是新的!我正在寻找解决方案而不是借口。

Edit:

编辑:

  • There is a proposal to add a networking library to standard library for TR2written by the author of Boost:asio (Christopher Kohlhoff). While it isn't documentation for boost:asio, it does use it as a base for the TR2 proposal. Since the author put more effort into this document, I have found it to be somewhat helpful, if not as a reference, then at least as an overview.
  • Boost:asio (Christopher Kohlhoff) 的作者提出了将网络库添加到 TR2 标准库建议。虽然它不是 boost:asio 的文档,但它确实将其用作 TR2 提案的基础。由于作者对这个文档付出了更多的努力,我发现它有点帮助,如果不是作为参考,那么至少作为一个概述。

采纳答案by Dean Michael

First, I've been using Boost.Asio for quite a while already -- and I share your concern. To address your question:

首先,我使用 Boost.Asio 已经有一段时间了——我和你一样担心。要解决您的问题:

  • There really is very scarce documentation about Boost.Asio aside from the introduction and tutorial. I am not the author, but this is mostly because there are just too many things to document for something as low-level as an Asynchronous IO Library.
  • The examples give more away than the tutorials do. If you don't mind spending a little time looking at the different examples, I would think they should suffice to get you started. If you want to run away with it, then the reference documentation should help you a lot.
  • Ask around in the Boost Users and Boost Developers mailing list if you're really stuck or looking for specific guidance. I'm pretty sure a lot of people will be willing to address your concerns on the mailing lists.
  • 除了介绍和教程之外,关于 Boost.Asio 的文档真的非常稀缺。我不是作者,但这主要是因为对于像异步 IO 库这样低级的东西,需要记录的东西太多了。
  • 这些示例比教程提供的更多。如果您不介意花一点时间查看不同的示例,我认为它们应该足以让您入门。如果你想逃避它,那么参考文档应该对你有很大帮助。
  • 如果您真的遇到困难或正在寻找具体指导,请在 Boost 用户和 Boost 开发人员邮件列表中询问。我很确定很多人会愿意在邮件列表上解决您的问题。

There are efforts (not part of Boost.Asio) to expose a lot of the functionality and possible alternative use cases. This at best is scattered around the web in blogs and other forms of non-packaged documentation.

有一些努力(不是 Boost.Asio 的一部分)来公开许多功能和可能的替代用例。这充其量是散布在网络上的博客和其他形式的非打包文档中。

One thing that is unclear and which will really need close coordination with the author and developers of the Boost.Asio library would be as far as extending and customizing it for a specific platform or adding specific new functionality. This should be improved though but the good thing is it's looking like Asio will be a reference implementation for a standard library technical report (for an asynchronous IO library in the STL) in the future.

一件事尚不清楚并且真正需要与 Boost.Asio 库的作者和开发人员密切协调,那就是针对特定平台对其进行扩展和定制或添加特定的新功能。虽然这应该得到改进,但好消息是它看起来像 Asio 将来会成为标准库技术报告(STL 中的异步 IO 库)的参考实现。

回答by Ralf

Some nice documentation on boost including a chapter on asio can be found in a (free) boost book at http://en.highscore.de/cpp/boost/index.html. The chapter on asio provides a general overview and then goes as far as how to develop your own custom asio extensions. Really fantastic effort by Boris Sch?ling!

可以在http://en.highscore.de/cpp/boost/index.html的(免费)boost 书中找到一些关于 boost 的不错的文档,包括关于 asio 的一章。关于 asio 的章节提供了一般概述,然后介绍了如何开发自己的自定义 asio 扩展。鲍里斯·施林 (Boris Sch?ling) 的努力真是太棒了!

回答by Alex Ott

I wrote two small articles that could be used as introductions to boost.asio. They are available from my site

我写了两篇小文章,可以作为boost.asio的介绍。它们可以从我的网站上获得

回答by M2tM

NOTE: I have contacted gamedev.net to let them know about the formatting issues. Unfortunately at the time of writing this comment, this resource is more difficult to recommend because of some changes with their website which hide/delete the #include statements + a missing .zip file resource.

注意:我已联系 gamedev.net 让他们了解格式问题。不幸的是,在撰写此评论时,此资源更难以推荐,因为其网站的一些更改隐藏/删除了 #include 语句 + 缺少 .zip 文件资源。

A relatively new and very good beginner tutorial for Boost.Asio (which also introduces how to use it effectively with bind, shared_ptr, and threads) can be found here:

可以在此处找到 Boost.Asio 的相对较新且非常好的初学者教程(还介绍了如何有效地将其与 bind、shared_ptr 和线程一起使用):

http://www.gamedev.net/blog/950/entry-2249317-a-guide-to-getting-started-with-boostasio?pg=1

http://www.gamedev.net/blog/950/entry-2249317-a-guide-to-getting-started-with-boostasio?pg=1

Note: If you're using c++0x features many of the simple uses of bind for creating a functor can be replaced with lambdas, and shared_ptr/bind are also available in the latest version of visual studio (or gcc which also includes threads.)

注意:如果你使用的是 c++0x 特性,bind 用于创建函子的许多简单用途都可以用 lambdas 替换,并且 shared_ptr/bind 在最新版本的 Visual Studio(或 gcc 也包括线程)中也可用.)

When I was searching for documentation or a tutorial this question kept popping up at the top of search results, so it is important to keep it updated as new tutorials come around.

当我搜索文档或教程时,这个问题一直在搜索结果的顶部弹出,因此随着新教程的出现,保持更新非常重要。

回答by Jean Davy

The asio documentation, the one available in boost, is minimalist but very precise, each word is significant. That said,I have learned asio (and continue to learn) mainly from SO.

asio 文档,boost 中可用的文档,极简但非常精确,每个词都很重要。也就是说,我主要从 SO 学习了 asio(并继续学习)。

In my opinion, the answerto 'Confused when boost::asio::io_service run method blocks/unblocks' is the very first step, read an read again until you really understand it, second answeris also helpful.

在笔者看来,答案为“时的boost ::支持ASIO :: io_service对象的run方法块/疏导困惑是第一步,阅读再阅读,直到你真正了解它”,第二个答案也很有帮助。

Then I have RSS subscribed to newest SO boost-asio tag questionand to these two answerers:

然后我让 RSS 订阅了最新的 SO boost-asio 标签问题和这两个回答者:

Tanner Sansburry, the author of the answer above, his answers are always very precise, comprehensive, with references, even beautiful schemas. RSS feed
Sehe(sorry Sehe, only 2nd). RSS feed

上面答案的作者Tanner Sansburry,他的答案总是非常精确、全面,有参考,甚至是漂亮的模式RSS提要
色赫(对不起色赫,只有第二个)。RSS订阅

With all that material, you will soon be an asio expert !

有了所有这些材料,您很快就会成为 asio 专家!

回答by A. Novikov

I was quite curious about that, too but this page gave me some head start. It's in French, but you could use google translate which is pretty readable (I had to follow down this path myself).

我对此也很好奇,但这个页面给了我一些先机。它是法语的,但你可以使用谷歌翻译,它非常易读(我必须自己沿着这条路走下去)。

http://gwenael-dunand.developpez.com/tutoriels/cpp/boost/asio/

http://gwenael-dunand.developpez.com/tutoriels/cpp/boost/asio/

回答by Dave F

A little late to the party but there's a book out called "Boost Asio Network Programming" (Packt publishing).

聚会有点晚了,但有一本名为“Boost Asio Network Programming”(Packt 出版)的书。

I bought a copy of this, read it over the weekend and then wrote a full on server in C++ without much problem.

我买了一本,周末读了一遍,然后用 C++ 在服务器上写了一个完整的,没有太大问题。

Disclaimer: I have nothing to do with the book

免责声明:我与本书无关

回答by Kisalay

I stumbled on the following pdf: http://boost.cowic.de/rc/pdf/asio_doc.pdf

我偶然发现了以下 pdf:http: //boost.cowic.de/rc/pdf/asio_doc.pdf