More overview changes.
This commit is contained in:
parent
255dfef849
commit
a7502027a1
@ -9,18 +9,19 @@
|
||||
|
||||
* [link asio.overview.rationale Rationale]
|
||||
* [link asio.overview.core Core Concepts and Functionality]
|
||||
* [link asio.overview.async The Proactor Design Pattern: Concurrency Without Threads]
|
||||
* [link asio.overview.strands Strands: Use Threads Without Explicit Locking]
|
||||
* Thread-safe message passing
|
||||
* [link asio.overview.core.async The Proactor Design Pattern: Concurrency Without Threads]
|
||||
* [link asio.overview.core.threads Threads and Asio]
|
||||
* [link asio.overview.core.strands Strands: Use Threads Without Explicit Locking]
|
||||
* Buffer management
|
||||
* Scatter-gather
|
||||
* Facilities for managing short reads/writes
|
||||
* Addition of new services
|
||||
* null_buffers reactor-style
|
||||
* [link asio.overview.line_based Line-Based Operations]
|
||||
* [link asio.overview.core.line_based Line-Based Operations]
|
||||
* [link asio.overview.core.allocation Custom Memory Allocation]
|
||||
* Networking
|
||||
* iostreams
|
||||
* [link asio.overview.bsd_sockets The BSD Socket API and Asio]
|
||||
* [link asio.overview.networking.iostreams Socket Iostreams]
|
||||
* [link asio.overview.networking.bsd_sockets The BSD Socket API and Asio]
|
||||
* IPv4 and IPv6 independence
|
||||
* TCP
|
||||
* UDP
|
||||
@ -37,35 +38,33 @@
|
||||
* [link asio.overview.windows.stream_handle Stream-Oriented HANDLEs]
|
||||
* [link asio.overview.windows.random_access_handle Random-Access HANDLEs]
|
||||
* [link asio.overview.ssl SSL]
|
||||
* [link asio.overview.implementation Platform-Specific Implementation Notes]
|
||||
|
||||
[include overview/rationale.qbk]
|
||||
|
||||
[section:core Core Concepts and Functionality]
|
||||
|
||||
* [link asio.overview.async The Proactor Design Pattern: Concurrency Without Threads]
|
||||
* [link asio.overview.strands Strands: Use Threads Without Explicit Locking]
|
||||
* Thread-safe message passing
|
||||
* Buffer management
|
||||
* Scatter-gather
|
||||
* Facilities for managing short reads/writes
|
||||
* Addition of new services
|
||||
* null_buffers reactor-style
|
||||
* [link asio.overview.line_based Line-Based Operations]
|
||||
[include overview/async.qbk]
|
||||
[include overview/threads.qbk]
|
||||
[include overview/strands.qbk]
|
||||
[include overview/buffers.qbk]
|
||||
[include overview/line_based.qbk]
|
||||
[include overview/allocation.qbk]
|
||||
[include overview/eof.qbk]
|
||||
|
||||
[endsect]
|
||||
|
||||
[include overview/async.qbk]
|
||||
[include overview/allocation.qbk]
|
||||
[include overview/buffers.qbk]
|
||||
[include overview/eof.qbk]
|
||||
[include overview/line_based.qbk]
|
||||
[include overview/threads.qbk]
|
||||
[include overview/strands.qbk]
|
||||
[include overview/implementation.qbk]
|
||||
[section:networking Networking]
|
||||
|
||||
[include overview/iostreams.qbk]
|
||||
[include overview/bsd_sockets.qbk]
|
||||
|
||||
[endsect]
|
||||
|
||||
[include overview/serial_ports.qbk]
|
||||
[include overview/posix.qbk]
|
||||
[include overview/windows.qbk]
|
||||
[include overview/ssl.qbk]
|
||||
[include overview/implementation.qbk]
|
||||
|
||||
[endsect]
|
||||
|
@ -48,4 +48,20 @@ The implementation will insert appropriate memory barriers to ensure correct
|
||||
memory visibility should allocation functions need to be called from different
|
||||
threads.
|
||||
|
||||
Custom memory allocation support is currently implemented for all asynchronous
|
||||
operations with the following exceptions:
|
||||
|
||||
* `ip::basic_resolver::async_resolve()` on all platforms.
|
||||
|
||||
* `basic_socket::async_connect()` on Windows.
|
||||
|
||||
* Any operation involving `null_buffers()` on Windows, other than an
|
||||
asynchronous read performed on a stream-oriented socket.
|
||||
|
||||
[heading See Also]
|
||||
|
||||
[link asio.reference.asio_handler_allocate asio_handler_allocate],
|
||||
[link asio.reference.asio_handler_deallocate asio_handler_deallocate],
|
||||
[link asio.examples.allocation custom memory allocation example].
|
||||
|
||||
[endsect]
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
The Asio library offers side-by-side support for synchronous and asynchronous
|
||||
operations. The asynchronous support is based on the Proactor design pattern
|
||||
[link asio.overview.async.references \[POSA2\]], and the advantages and
|
||||
[link asio.overview.core.async.references \[POSA2\]], and the advantages and
|
||||
disadvantages of this approach, when compared to a synchronous-only or Reactor
|
||||
approach, are outlined below.
|
||||
|
||||
|
@ -7,14 +7,20 @@
|
||||
|
||||
[section:bsd_sockets The BSD Socket API and Asio]
|
||||
|
||||
The networking components of Asio are modelled on concepts from the BSD Socket
|
||||
API. The major point of difference is that Asio provides strong type safety, to
|
||||
the point of having different types for different protocols' sockets. For
|
||||
example, in Asio `ip::tcp::socket` and `ip::udp::socket` are separate types
|
||||
whereas in the BSD Socket API both are represented by an integer socket
|
||||
descriptor.
|
||||
The Asio library includes a low-level socket interface based on the BSD socket
|
||||
API, which is widely implemented and supported by extensive literature. It is
|
||||
also used as the basis for networking APIs in other languages, like Java. This
|
||||
low-level interface is designed to support the development of efficient and
|
||||
scalable applications. For example, it permits programmers to exert finer
|
||||
control over the number of system calls, avoid redundant data copying, minimise
|
||||
the use of resources like threads, and so on.
|
||||
|
||||
The following table shows the mapping between the BSD Socket API and Asio:
|
||||
Unsafe and error prone aspects of the BSD socket API not included. For example,
|
||||
the use of `int` to represent all sockets lacks type safety. The socket
|
||||
representation in Asio uses a distinct type for each protocol, e.g. for TCP one
|
||||
would use `ip::tcp::socket`, and for UDP one uses `ip::udp::socket`.
|
||||
|
||||
The following table shows the mapping between the BSD socket API and Asio:
|
||||
|
||||
[table
|
||||
[
|
||||
@ -23,63 +29,63 @@ The following table shows the mapping between the BSD Socket API and Asio:
|
||||
]
|
||||
[
|
||||
[socket descriptor - `int` (POSIX) or `SOCKET` (Windows)]
|
||||
[ For TCP: [link asio.reference.ip__tcp.socket `ip::tcp::socket`],
|
||||
[link asio.reference.ip__tcp.acceptor `ip::tcp::acceptor`]
|
||||
[ For TCP: [link asio.reference.ip__tcp.socket ip::tcp::socket],
|
||||
[link asio.reference.ip__tcp.acceptor ip::tcp::acceptor]
|
||||
|
||||
For UDP: [link asio.reference.ip__udp.socket `ip::udp::socket`]
|
||||
For UDP: [link asio.reference.ip__udp.socket ip::udp::socket]
|
||||
|
||||
[link asio.reference.basic_socket `basic_socket`],
|
||||
[link asio.reference.basic_stream_socket `basic_stream_socket`],
|
||||
[link asio.reference.basic_datagram_socket `basic_datagram_socket`],
|
||||
[link asio.reference.basic_raw_socket `basic_raw_socket`] ]
|
||||
[link asio.reference.basic_socket basic_socket],
|
||||
[link asio.reference.basic_stream_socket basic_stream_socket],
|
||||
[link asio.reference.basic_datagram_socket basic_datagram_socket],
|
||||
[link asio.reference.basic_raw_socket basic_raw_socket] ]
|
||||
]
|
||||
[
|
||||
[`in_addr`,
|
||||
`in6_addr`]
|
||||
[ [link asio.reference.ip__address `ip::address`],
|
||||
[link asio.reference.ip__address `ip::address_v4`],
|
||||
[link asio.reference.ip__address `ip::address_v6`] ]
|
||||
[ [link asio.reference.ip__address ip::address],
|
||||
[link asio.reference.ip__address ip::address_v4],
|
||||
[link asio.reference.ip__address ip::address_v6] ]
|
||||
]
|
||||
[
|
||||
[`sockaddr_in`,
|
||||
`sockaddr_in6`]
|
||||
[ For TCP: [link asio.reference.ip__tcp.endpoint `ip::tcp::endpoint`]
|
||||
[ For TCP: [link asio.reference.ip__tcp.endpoint ip::tcp::endpoint]
|
||||
|
||||
For UDP: [link asio.reference.ip__udp.endpoint `ip::udp::endpoint`]
|
||||
For UDP: [link asio.reference.ip__udp.endpoint ip::udp::endpoint]
|
||||
|
||||
[link asio.reference.ip__basic_endpoint `ip::basic_endpoint`] ]
|
||||
[link asio.reference.ip__basic_endpoint ip::basic_endpoint] ]
|
||||
]
|
||||
[
|
||||
[`accept()`]
|
||||
[ For TCP: [link asio.reference.basic_socket_acceptor.accept `ip::tcp::acceptor::accept()`]
|
||||
[ For TCP: [link asio.reference.basic_socket_acceptor.accept ip::tcp::acceptor::accept()]
|
||||
|
||||
[link asio.reference.basic_socket_acceptor.accept `basic_socket_acceptor::accept()`] ]
|
||||
[link asio.reference.basic_socket_acceptor.accept basic_socket_acceptor::accept()] ]
|
||||
]
|
||||
[
|
||||
[`bind()`]
|
||||
[ For TCP: [link asio.reference.basic_socket.bind `ip::tcp::acceptor::bind()`],
|
||||
[link asio.reference.basic_socket.bind `ip::tcp::socket::bind()`]
|
||||
[ For TCP: [link asio.reference.basic_socket.bind ip::tcp::acceptor::bind()],
|
||||
[link asio.reference.basic_socket.bind ip::tcp::socket::bind()]
|
||||
|
||||
For UDP: [link asio.reference.basic_socket.bind `ip::udp::socket::bind()`]
|
||||
For UDP: [link asio.reference.basic_socket.bind ip::udp::socket::bind()]
|
||||
|
||||
[link asio.reference.basic_socket.bind `basic_socket::bind()`] ]
|
||||
[link asio.reference.basic_socket.bind basic_socket::bind()] ]
|
||||
]
|
||||
[
|
||||
[`close()`]
|
||||
[ For TCP: [link asio.reference.basic_socket.close `ip::tcp::acceptor::close()`],
|
||||
[link asio.reference.basic_socket.close `ip::tcp::socket::close()`]
|
||||
[ For TCP: [link asio.reference.basic_socket.close ip::tcp::acceptor::close()],
|
||||
[link asio.reference.basic_socket.close ip::tcp::socket::close()]
|
||||
|
||||
For UDP: [link asio.reference.basic_socket.close `ip::udp::socket::close()`]
|
||||
For UDP: [link asio.reference.basic_socket.close ip::udp::socket::close()]
|
||||
|
||||
[link asio.reference.basic_socket.close `basic_socket::close()`] ]
|
||||
[link asio.reference.basic_socket.close basic_socket::close()] ]
|
||||
]
|
||||
[
|
||||
[`connect()`]
|
||||
[ For TCP: [link asio.reference.basic_socket.connect `ip::tcp::socket::connect()`]
|
||||
[ For TCP: [link asio.reference.basic_socket.connect ip::tcp::socket::connect()]
|
||||
|
||||
For UDP: [link asio.reference.basic_socket.connect `ip::udp::socket::connect()`]
|
||||
For UDP: [link asio.reference.basic_socket.connect ip::udp::socket::connect()]
|
||||
|
||||
[link asio.reference.basic_socket.connect `basic_socket::connect()`] ]
|
||||
[link asio.reference.basic_socket.connect basic_socket::connect()] ]
|
||||
]
|
||||
[
|
||||
[`getaddrinfo()`,
|
||||
@ -88,82 +94,82 @@ The following table shows the mapping between the BSD Socket API and Asio:
|
||||
`getnameinfo()`,
|
||||
`getservbyname()`,
|
||||
`getservbyport()`]
|
||||
[ For TCP: [link asio.reference.basic_resolver.resolve `ip::tcp::resolver::resolve()`],
|
||||
[link asio.reference.basic_resolver.async_resolve `ip::tcp::resolver::async_resolve()`]
|
||||
[ For TCP: [link asio.reference.ip__basic_resolver.resolve ip::tcp::resolver::resolve()],
|
||||
[link asio.reference.ip__basic_resolver.async_resolve ip::tcp::resolver::async_resolve()]
|
||||
|
||||
For UDP: [link asio.reference.basic_resolver.resolve `ip::udp::resolver::resolve()`],
|
||||
[link asio.reference.basic_resolver.async_resolve `ip::udp::resolver::async_resolve()`]
|
||||
For UDP: [link asio.reference.ip__basic_resolver.resolve ip::udp::resolver::resolve()],
|
||||
[link asio.reference.ip__basic_resolver.async_resolve ip::udp::resolver::async_resolve()]
|
||||
|
||||
[link asio.reference.basic_resolver.resolve `ip::basic_resolver::resolve()`],
|
||||
[link asio.reference.basic_resolver.async_resolve `ip::basic_resolver::async_resolve()`] ]
|
||||
[link asio.reference.ip__basic_resolver.resolve ip::basic_resolver::resolve()],
|
||||
[link asio.reference.ip__basic_resolver.async_resolve ip::basic_resolver::async_resolve()] ]
|
||||
]
|
||||
[
|
||||
[`gethostname()`]
|
||||
[ [link asio.reference.ip.gethostname `ip::gethostname()`] ]
|
||||
[ [link asio.reference.ip__gethostname ip::gethostname()] ]
|
||||
]
|
||||
[
|
||||
[`getpeername()`]
|
||||
[ For TCP: [link asio.reference.basic_socket.remote_endpoint `ip::tcp::socket::remote_endpoint()`]
|
||||
[ For TCP: [link asio.reference.basic_socket.remote_endpoint ip::tcp::socket::remote_endpoint()]
|
||||
|
||||
For UDP: [link asio.reference.basic_socket.remote_endpoint `ip::udp::socket::remote_endpoint()`]
|
||||
For UDP: [link asio.reference.basic_socket.remote_endpoint ip::udp::socket::remote_endpoint()]
|
||||
|
||||
[link asio.reference.basic_socket.remote_endpoint `basic_socket::remote_endpoint()`] ]
|
||||
[link asio.reference.basic_socket.remote_endpoint basic_socket::remote_endpoint()] ]
|
||||
]
|
||||
[
|
||||
[`getsockname()`]
|
||||
[ For TCP: [link asio.reference.basic_socket.local_endpoint `ip::tcp::acceptor::local_endpoint()`],
|
||||
[link asio.reference.basic_socket.local_endpoint `ip::tcp::socket::local_endpoint()`]
|
||||
[ For TCP: [link asio.reference.basic_socket.local_endpoint ip::tcp::acceptor::local_endpoint()],
|
||||
[link asio.reference.basic_socket.local_endpoint ip::tcp::socket::local_endpoint()]
|
||||
|
||||
For UDP: [link asio.reference.basic_socket.local_endpoint `ip::udp::socket::local_endpoint()`]
|
||||
For UDP: [link asio.reference.basic_socket.local_endpoint ip::udp::socket::local_endpoint()]
|
||||
|
||||
[link asio.reference.basic_socket.local_endpoint `basic_socket::local_endpoint()`] ]
|
||||
[link asio.reference.basic_socket.local_endpoint basic_socket::local_endpoint()] ]
|
||||
]
|
||||
[
|
||||
[`getsockopt()`]
|
||||
[ For TCP: [link asio.reference.basic_socket.get_option `ip::tcp::acceptor::get_option()`],
|
||||
[link asio.reference.basic_socket.get_option `ip::tcp::socket::get_option()`]
|
||||
[ For TCP: [link asio.reference.basic_socket.get_option ip::tcp::acceptor::get_option()],
|
||||
[link asio.reference.basic_socket.get_option ip::tcp::socket::get_option()]
|
||||
|
||||
For UDP: [link asio.reference.basic_socket.get_option `ip::udp::socket::get_option()`]
|
||||
For UDP: [link asio.reference.basic_socket.get_option ip::udp::socket::get_option()]
|
||||
|
||||
[link asio.reference.basic_socket.get_option `basic_socket::get_option()`] ]
|
||||
[link asio.reference.basic_socket.get_option basic_socket::get_option()] ]
|
||||
]
|
||||
[
|
||||
[`inet_addr()`,
|
||||
`inet_aton()`,
|
||||
`inet_pton()`]
|
||||
[ [link asio.reference.ip__address.from_string `ip::address::from_string()`],
|
||||
[link asio.reference.ip__address.from_string `ip::address_v4::from_string()`],
|
||||
[link asio.reference.ip__address.from_string `ip_address_v6::from_string()`] ]
|
||||
[ [link asio.reference.ip__address.from_string ip::address::from_string()],
|
||||
[link asio.reference.ip__address.from_string ip::address_v4::from_string()],
|
||||
[link asio.reference.ip__address.from_string ip_address_v6::from_string()] ]
|
||||
]
|
||||
[
|
||||
[`inet_ntoa()`,
|
||||
`inet_ntop()`]
|
||||
[ [link asio.reference.ip__address.to_string `ip::address::to_string()`],
|
||||
[link asio.reference.ip__address.to_string `ip::address_v4::to_string()`],
|
||||
[link asio.reference.ip__address.to_string `ip_address_v6::to_string()`] ]
|
||||
[ [link asio.reference.ip__address.to_string ip::address::to_string()],
|
||||
[link asio.reference.ip__address.to_string ip::address_v4::to_string()],
|
||||
[link asio.reference.ip__address.to_string ip_address_v6::to_string()] ]
|
||||
]
|
||||
[
|
||||
[`ioctl()`]
|
||||
[ For TCP: [link asio.reference.basic_socket.io_control `ip::tcp::socket::io_control()`]
|
||||
[ For TCP: [link asio.reference.basic_socket.io_control ip::tcp::socket::io_control()]
|
||||
|
||||
For UDP: [link asio.reference.basic_socket.io_control `ip::udp::socket::io_control()`]
|
||||
For UDP: [link asio.reference.basic_socket.io_control ip::udp::socket::io_control()]
|
||||
|
||||
[link asio.reference.basic_socket.io_control `basic_socket::io_control()`] ]
|
||||
[link asio.reference.basic_socket.io_control basic_socket::io_control()] ]
|
||||
]
|
||||
[
|
||||
[`listen()`]
|
||||
[ For TCP: [link asio.reference.basic_socket_acceptor.listen `ip::tcp::acceptor::listen()`]
|
||||
[ For TCP: [link asio.reference.basic_socket_acceptor.listen ip::tcp::acceptor::listen()]
|
||||
|
||||
[link asio.reference.basic_socket_acceptor.listen `basic_socket_acceptor::listen()`] ]
|
||||
[link asio.reference.basic_socket_acceptor.listen basic_socket_acceptor::listen()] ]
|
||||
]
|
||||
[
|
||||
[`poll()`,
|
||||
`select()`,
|
||||
`pselect()`]
|
||||
[ [link asio.reference.io_service.run `io_service::run()`],
|
||||
[link asio.reference.io_service.run_one `io_service::run_one()`],
|
||||
[link asio.reference.io_service.poll `io_service::poll()`],
|
||||
[link asio.reference.io_service.poll_one `io_service::poll_one()`]
|
||||
[ [link asio.reference.io_service.run io_service::run()],
|
||||
[link asio.reference.io_service.run_one io_service::run_one()],
|
||||
[link asio.reference.io_service.poll io_service::poll()],
|
||||
[link asio.reference.io_service.poll_one io_service::poll_one()]
|
||||
|
||||
Note: in conjunction with asynchronous operations. ]
|
||||
]
|
||||
@ -171,91 +177,91 @@ The following table shows the mapping between the BSD Socket API and Asio:
|
||||
[`readv()`,
|
||||
`recv()`,
|
||||
`read()`]
|
||||
[ For TCP: [link asio.reference.basic_stream_socket.read_some `ip::tcp::socket::read_some()`],
|
||||
[link asio.reference.basic_stream_socket.async_read_some `ip::tcp::socket::async_read_some()`],
|
||||
[link asio.reference.basic_stream_socket.receive `ip::tcp::socket::receive()`],
|
||||
[link asio.reference.basic_stream_socket.async_receive `ip::tcp::socket::async_receive()`]
|
||||
[ For TCP: [link asio.reference.basic_stream_socket.read_some ip::tcp::socket::read_some()],
|
||||
[link asio.reference.basic_stream_socket.async_read_some ip::tcp::socket::async_read_some()],
|
||||
[link asio.reference.basic_stream_socket.receive ip::tcp::socket::receive()],
|
||||
[link asio.reference.basic_stream_socket.async_receive ip::tcp::socket::async_receive()]
|
||||
|
||||
For UDP: [link asio.reference.basic_datagram_socket.receive `ip::udp::socket::receive()`],
|
||||
[link asio.reference.basic_datagram_socket.async_receive `ip::udp::socket::async_receive()`]
|
||||
For UDP: [link asio.reference.basic_datagram_socket.receive ip::udp::socket::receive()],
|
||||
[link asio.reference.basic_datagram_socket.async_receive ip::udp::socket::async_receive()]
|
||||
|
||||
[link asio.reference.basic_stream_socket.read_some `basic_stream_socket::read_some()`],
|
||||
[link asio.reference.basic_stream_socket.async_read_some `basic_stream_socket::async_read_some()`],
|
||||
[link asio.reference.basic_stream_socket.receive `basic_stream_socket::receive()`],
|
||||
[link asio.reference.basic_stream_socket.async_receive `basic_stream_socket::async_receive()`],
|
||||
[link asio.reference.basic_datagram_socket.receive `basic_datagram_socket::receive()`],
|
||||
[link asio.reference.basic_datagram_socket.async_receive `basic_datagram_socket::async_receive()`] ]
|
||||
[link asio.reference.basic_stream_socket.read_some basic_stream_socket::read_some()],
|
||||
[link asio.reference.basic_stream_socket.async_read_some basic_stream_socket::async_read_some()],
|
||||
[link asio.reference.basic_stream_socket.receive basic_stream_socket::receive()],
|
||||
[link asio.reference.basic_stream_socket.async_receive basic_stream_socket::async_receive()],
|
||||
[link asio.reference.basic_datagram_socket.receive basic_datagram_socket::receive()],
|
||||
[link asio.reference.basic_datagram_socket.async_receive basic_datagram_socket::async_receive()] ]
|
||||
]
|
||||
[
|
||||
[`recvfrom()`]
|
||||
[ For UDP: [link asio.reference.basic_datagram_socket.receive_from `ip::udp::socket::receive_from()`],
|
||||
[link asio.reference.basic_datagram_socket.async_receive_from `ip::udp::socket::async_receive_from()`]
|
||||
[ For UDP: [link asio.reference.basic_datagram_socket.receive_from ip::udp::socket::receive_from()],
|
||||
[link asio.reference.basic_datagram_socket.async_receive_from ip::udp::socket::async_receive_from()]
|
||||
|
||||
[link asio.reference.basic_datagram_socket.receive_from `basic_datagram_socket::receive_from()`],
|
||||
[link asio.reference.basic_datagram_socket.async_receive_from `basic_datagram_socket::async_receive_from()`] ]
|
||||
[link asio.reference.basic_datagram_socket.receive_from basic_datagram_socket::receive_from()],
|
||||
[link asio.reference.basic_datagram_socket.async_receive_from basic_datagram_socket::async_receive_from()] ]
|
||||
]
|
||||
[
|
||||
[`send()`,
|
||||
`write()`,
|
||||
`writev()`]
|
||||
[ For TCP: [link asio.reference.basic_stream_socket.write_some `ip::tcp::socket::write_some()`],
|
||||
[link asio.reference.basic_stream_socket.async_write_some `ip::tcp::socket::async_write_some()`],
|
||||
[link asio.reference.basic_stream_socket.send `ip::tcp::socket::send()`],
|
||||
[link asio.reference.basic_stream_socket.async_send `ip::tcp::socket::async_send()`]
|
||||
[ For TCP: [link asio.reference.basic_stream_socket.write_some ip::tcp::socket::write_some()],
|
||||
[link asio.reference.basic_stream_socket.async_write_some ip::tcp::socket::async_write_some()],
|
||||
[link asio.reference.basic_stream_socket.send ip::tcp::socket::send()],
|
||||
[link asio.reference.basic_stream_socket.async_send ip::tcp::socket::async_send()]
|
||||
|
||||
For UDP: [link asio.reference.basic_datagram_socket.send `ip::udp::socket::send()`],
|
||||
[link asio.reference.basic_datagram_socket.async_send `ip::udp::socket::async_send()`]
|
||||
For UDP: [link asio.reference.basic_datagram_socket.send ip::udp::socket::send()],
|
||||
[link asio.reference.basic_datagram_socket.async_send ip::udp::socket::async_send()]
|
||||
|
||||
[link asio.reference.basic_stream_socket.write_some `basic_stream_socket::write_some()`],
|
||||
[link asio.reference.basic_stream_socket.async_write_some `basic_stream_socket::async_write_some()`],
|
||||
[link asio.reference.basic_stream_socket.send `basic_stream_socket::send()`],
|
||||
[link asio.reference.basic_stream_socket.async_send `basic_stream_socket::async_send()`],
|
||||
[link asio.reference.basic_datagram_socket.send `basic_datagram_socket::send()`],
|
||||
[link asio.reference.basic_datagram_socket.async_send `basic_datagram_socket::async_send()`] ]
|
||||
[link asio.reference.basic_stream_socket.write_some basic_stream_socket::write_some()],
|
||||
[link asio.reference.basic_stream_socket.async_write_some basic_stream_socket::async_write_some()],
|
||||
[link asio.reference.basic_stream_socket.send basic_stream_socket::send()],
|
||||
[link asio.reference.basic_stream_socket.async_send basic_stream_socket::async_send()],
|
||||
[link asio.reference.basic_datagram_socket.send basic_datagram_socket::send()],
|
||||
[link asio.reference.basic_datagram_socket.async_send basic_datagram_socket::async_send()] ]
|
||||
]
|
||||
[
|
||||
[`sendto()`]
|
||||
[ For UDP: [link asio.reference.basic_datagram_socket.send_to `ip::udp::socket::send_to()`],
|
||||
[link asio.reference.basic_datagram_socket.async_send_to `ip::udp::socket::async_send_to()`]
|
||||
[ For UDP: [link asio.reference.basic_datagram_socket.send_to ip::udp::socket::send_to()],
|
||||
[link asio.reference.basic_datagram_socket.async_send_to ip::udp::socket::async_send_to()]
|
||||
|
||||
[link asio.reference.basic_datagram_socket.send_to `basic_datagram_socket::send_to()`],
|
||||
[link asio.reference.basic_datagram_socket.async_send_to `basic_datagram_socket::async_send_to()`] ]
|
||||
[link asio.reference.basic_datagram_socket.send_to basic_datagram_socket::send_to()],
|
||||
[link asio.reference.basic_datagram_socket.async_send_to basic_datagram_socket::async_send_to()] ]
|
||||
]
|
||||
[
|
||||
[`setsockopt()`]
|
||||
[ For TCP: [link asio.reference.basic_socket.set_option `ip::tcp::acceptor::set_option()`],
|
||||
[link asio.reference.basic_socket.set_option `ip::tcp::socket::set_option()`]
|
||||
[ For TCP: [link asio.reference.basic_socket.set_option ip::tcp::acceptor::set_option()],
|
||||
[link asio.reference.basic_socket.set_option ip::tcp::socket::set_option()]
|
||||
|
||||
For UDP: [link asio.reference.basic_socket.set_option `ip::udp::socket::set_option()`]
|
||||
For UDP: [link asio.reference.basic_socket.set_option ip::udp::socket::set_option()]
|
||||
|
||||
[link asio.reference.basic_socket.set_option `basic_socket::set_option()`] ]
|
||||
[link asio.reference.basic_socket.set_option basic_socket::set_option()] ]
|
||||
]
|
||||
[
|
||||
[`shutdown()`]
|
||||
[ For TCP: [link asio.reference.basic_socket.shutdown `ip::tcp::socket::shutdown()`]
|
||||
[ For TCP: [link asio.reference.basic_socket.shutdown ip::tcp::socket::shutdown()]
|
||||
|
||||
For UDP: [link asio.reference.basic_socket.shutdown `ip::udp::socket::shutdown()`]
|
||||
For UDP: [link asio.reference.basic_socket.shutdown ip::udp::socket::shutdown()]
|
||||
|
||||
[link asio.reference.basic_socket.shutdown `basic_socket::shutdown()`] ]
|
||||
[link asio.reference.basic_socket.shutdown basic_socket::shutdown()] ]
|
||||
]
|
||||
[
|
||||
[`sockatmark()`]
|
||||
[ For TCP: [link asio.reference.basic_socket.at_mark `ip::tcp::socket::at_mark()`]
|
||||
[ For TCP: [link asio.reference.basic_socket.at_mark ip::tcp::socket::at_mark()]
|
||||
|
||||
[link asio.reference.basic_socket.at_mark `basic_socket::at_mark()`] ]
|
||||
[link asio.reference.basic_socket.at_mark basic_socket::at_mark()] ]
|
||||
]
|
||||
[
|
||||
[`socket()`]
|
||||
[ For TCP: [link asio.reference.basic_socket.open `ip::tcp::acceptor::open()`],
|
||||
[link asio.reference.basic_socket.open `ip::tcp::socket::open()`]
|
||||
[ For TCP: [link asio.reference.basic_socket.open ip::tcp::acceptor::open()],
|
||||
[link asio.reference.basic_socket.open ip::tcp::socket::open()]
|
||||
|
||||
For UDP: [link asio.reference.basic_socket.open `ip::udp::socket::open()`]
|
||||
For UDP: [link asio.reference.basic_socket.open ip::udp::socket::open()]
|
||||
|
||||
[link asio.reference.basic_socket.open `basic_socket::open()`] ]
|
||||
[link asio.reference.basic_socket.open basic_socket::open()] ]
|
||||
]
|
||||
[
|
||||
[`socketpair()`]
|
||||
[ [link asio.reference.local__connect_pair `local::connect_pair()`]
|
||||
[ [link asio.reference.local__connect_pair local::connect_pair()]
|
||||
|
||||
Note: POSIX operating systems only. ]
|
||||
]
|
||||
|
@ -5,9 +5,9 @@
|
||||
/ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
/]
|
||||
|
||||
[section:implementation Platform-Specific Implementation]
|
||||
[section:implementation Platform-Specific Implementation Notes]
|
||||
|
||||
This design note lists platform-specific implementation details, such as the
|
||||
This section lists platform-specific implementation details, such as the
|
||||
default demultiplexing mechanism, the number of threads created internally, and
|
||||
when threads are created.
|
||||
|
||||
|
46
asio/src/doc/overview/iostreams.qbk
Normal file
46
asio/src/doc/overview/iostreams.qbk
Normal file
@ -0,0 +1,46 @@
|
||||
[/
|
||||
/ Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
/
|
||||
/ Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
/ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
/]
|
||||
|
||||
[section:iostreams Socket Iostreams]
|
||||
|
||||
Asio includes classes that implement iostreams on top of sockets. These hide
|
||||
away the complexities associated with endpoint resolution, protocol
|
||||
independence, etc. To create a connection one might simply write:
|
||||
|
||||
ip::tcp::iostream stream("www.boost.org", "http");
|
||||
if (!stream)
|
||||
{
|
||||
// Can't connect.
|
||||
}
|
||||
|
||||
The iostream class can also be used in conjunction with an acceptor to create
|
||||
simple servers. For example:
|
||||
|
||||
io_service ios;
|
||||
|
||||
ip::tcp::endpoint endpoint(tcp::v4(), 80);
|
||||
ip::tcp::acceptor acceptor(ios, endpoint);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
ip::tcp::iostream stream;
|
||||
acceptor.accept(*stream.rdbuf());
|
||||
...
|
||||
}
|
||||
|
||||
[heading See Also]
|
||||
|
||||
[link asio.reference.ip__tcp.iostream ip::tcp::iostream],
|
||||
[link asio.reference.basic_socket_iostream basic_socket_iostream],
|
||||
[link asio.examples.iostreams iostreams examples].
|
||||
|
||||
[heading Notes]
|
||||
|
||||
These iostream templates only support `char`, not `wchar_t`, and do not perform
|
||||
any code conversion.
|
||||
|
||||
[endsect]
|
@ -5,7 +5,7 @@
|
||||
/ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
/]
|
||||
|
||||
[section:threads Threads]
|
||||
[section:threads Threads and Asio]
|
||||
|
||||
[heading Thread Safety]
|
||||
|
||||
@ -14,6 +14,17 @@ to make concurrent use of a single object. However, types such as `io_service`
|
||||
provide a stronger guarantee that it is safe to use a single object
|
||||
concurrently.
|
||||
|
||||
[heading Thread Pools]
|
||||
|
||||
Multiple threads may call `io_service::run()` to set up a pool of threads from
|
||||
which completion handlers may be invoked. This approach may also be used with
|
||||
`io_service::post()` to use a means to perform any computational tasks across a
|
||||
thread pool.
|
||||
|
||||
Note that all threads that have joined an `io_service`'s pool are considered
|
||||
equivalent, and the `io_service` may distribute work across them in an
|
||||
arbitrary fashion.
|
||||
|
||||
[heading Internal Threads]
|
||||
|
||||
The implementation of this library for a particular platform may make use of
|
||||
@ -24,8 +35,15 @@ these threads must be invisible to the library user. In particular, the threads:
|
||||
|
||||
* must block all signals.
|
||||
|
||||
(Note: the implementation of the asynchronous resolver operations currently
|
||||
violates the first of these rules.)
|
||||
[note The implementation currently violates the first of these rules for the
|
||||
following functions:
|
||||
|
||||
[mdash] `ip::basic_resolver::async_resolve()` on all platforms.
|
||||
|
||||
[mdash] `basic_socket::async_connect()` on Windows.
|
||||
|
||||
[mdash] Any operation involving `null_buffers()` on Windows, other than an
|
||||
asynchronous read performed on a stream-oriented socket.]
|
||||
|
||||
This approach is complemented by the following guarantee:
|
||||
|
||||
@ -51,4 +69,8 @@ The reasons for this approach include:
|
||||
management, and permits implementations on platforms where threads are not
|
||||
available.
|
||||
|
||||
[heading See Also]
|
||||
|
||||
[link asio.reference.io_service io_service].
|
||||
|
||||
[endsect]
|
||||
|
Loading…
Reference in New Issue
Block a user