• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1[/
2    Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
3
4    Distributed under the Boost Software License, Version 1.0. (See accompanying
5    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6
7    Official repository: https://github.com/boostorg/beast
8]
9
10[section:using_io Networking]
11
12This library uses the
13[@http://cplusplus.github.io/networking-ts/draft.pdf Networking Technical Specification],
14scheduled to become an official part of C++ no sooner than the year
152023. Three implementations exist, with cosmetic differences but
16otherwise using the same function signatures and type declarations:
17Boost.Asio, stand-alone Asio, and networking-ts-impl. This table shows
18how a variable of type `io_context` is declared in each implementation
19by including the appropriate header and using a suitable namespace alias:
20
21[table Networking Implementations
22[[Name][Namespace and Header Example ]]
23[
24    [__Asio__]
25    [
26```
27        #include <boost/asio/io_context.hpp>
28        namespace net = boost::asio;
29        net::io_context ioc;
30```
31    ]
32][
33    [[@https://think-async.com/Asio/ Asio (Standalone)]]
34    [
35```
36        #include <asio/io_context.hpp>
37        namespace net = asio;
38        net::io_context ioc;
39```
40    ]
41][
42    [[@https://github.com/chriskohlhoff/networking-ts-impl networking-ts-impl]]
43    [
44```
45        #include <experimental/io_context>
46        namespace net = std::experimental::net;
47        net::io_context ioc;
48```
49    ]
50]
51]
52
53This document refers to the three implementations above interchangeably and
54collectively as [*Networking] (or just ['networking]). The Boost.Asio and
55Asio flavors of Networking provide additional features not currently proposed
56for C++, but likely to appear in a future specification, such as:
57
58* [@boost:/doc/html/boost_asio/reference/serial_port.html Serial ports]
59* [@boost:/doc/html/boost_asio/reference/local__stream_protocol.html UNIX domain sockets]
60* [@boost:/doc/html/boost_asio/reference/signal_set.html POSIX signals] (e.g. SIGINT, SIGABORT)
61* [@boost:/doc/html/boost_asio/reference/ssl__stream.html TLS streams] (such as OpenSSL)
62
63Boost.Beast depends specifically on the Boost.Asio flavor of Networking,
64although this may change in the future.
65While this library offers performant implementations of the HTTP and
66WebSocket network protocols, it depends on the networking interfaces
67to perform general tasks such as performing domain name resolution
68(DNS lookup), establishing outgoing connections, and accepting incoming
69connections. Callers are responsible for interacting with networking
70to initialize objects to the correct state where they are usable by
71this library.
72
73In this documentation, the example code, and the implementation, the `net`
74namespace is used to qualify Networking identifiers. For Boost.Beast,
75`net` will be an alias for the `boost::asio` namespace.
76
77To further ease of use, this library provides an extensive collection
78of types and algorithms. This section of the documentation explains these
79types and algorithms, provides examples of usage, and also provides
80refreshers and tutorials for working with networking.
81
82[heading Abbreviations]
83
84This documentation assumes familiarity with __Asio__, which is
85required to work with Beast. Sample code and identifiers used
86throughout are written as if the following declarations are in
87effect:
88
89[snippet_core_1a]
90[snippet_core_1b]
91
92[include 1_refresher.qbk]
93[include 2_streams.qbk]
94[include 3_timeouts.qbk]
95[include 4__layers.qbk]
96[include 5_buffers.qbk]
97[include 6_files.qbk]
98[include 7_composed.qbk]
99[endsect]
100
101[section:config Configuration]
102[include 8_conf_macros.qbk]
103[endsect]
104