...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
std::future
availability
with libstdc++.
read_until
.
std::experimental::string_view
and std::string_view
with newer clang/libc++.
std::invoke_result
.
decltype
is available.
size()
, max_size()
or
empty()
on default-constructed resolver results.
std::string_view
detection issue when using clang-cl.
io_context::executor_type::dispatch
.
basic_socket_acceptor::get_option
.
experimental::detached
completion token.
experimental::redirect_error
completion token.
experimental::co_spawn
facility for integration
with the coroutines technical specification.
asio::steady_timer
rather than asio::deadline_timer
.
asio::dynamic_buffer
rather than asio::streambuf
.
asio::io_context::run_for()
function for
blocking clients.
BOOST_ASIO_NO_DEPRECATED
is defined.
BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM
to enable the old Boost.Date_Time interface in basic_socket_streambuf
and basic_socket_iostream
.
is_dynamic_buffer
trait.
async_result
incompatibility with deprecated handler_type
.
basic_resolver_results::value_type
typedef.
SSL_OP_NO_COMPRESSION
is defined.
add_certificate_authority
to process multiple certificates
in a bundle.
std::invoke_result
rather than std::result_of
.
std::string_view
for C++17 or later, and std::experimental::string_view
for C++14. Define the preprocessor macro BOOST_ASIO_DISABLE_STD_STRING_VIEW
to force the use of std::experimental::string_view (assuming it is available)
when compiling in C++17 mode.
DynamicBuffer
template arguments are decayed before
using in enable_if
tests.
basic_yield_context
to work with completion signatures
containing reference parameters.
spawn()
correctly
store decayed copies of their function and handler arguments.
basic_socket<Protocol,
SocketService>
we now have simply basic_socket<Protocol>
.
The old interface can be enabled by defining the BOOST_ASIO_ENABLE_OLD_SERVICES
macro.
io_context
basis.
ssl::stream<>
constructor argument.
g++
versions >= 4.7 to use standard
atomics, to fix a linker error when using g++
4.6 (#13121).
constexpr
and variadic templates with recent
MSVC versions.
auto_ptr
.
asio_handler_is_continuation
result
in reactive async_accept
implementation.
poll.h
rather than sys/poll.h
on some modern POSIX platforms (#12419).
__thread
keyword extension for android/clang/x86
targets.
EAGAIN
or EWOULDBLOCK
)
with posix::stream_descriptor
, when using the Linux epoll
backend.
allocator_traits
to rebind allocators in C++11
or later.
ssl::context_base
enumerations to enable support
for any TLS version, and improved consistency of SSL/TLS version handling
across OpenSSL releases.
gcc
(#12302).
std::atomic_thread_fence
, when available,
to eliminate a deprecated function warning on newest macOS SDK (#12482).
getaddrinfo
in Apple's NAT64
environment.
asio::connect()
when the
connect_condition
returns an end iterator (#12354).
getsockname
reports 0.0.0.0 (#12406).
SSL_COMP_free_compression_methods
to fix two
memory leaks reported at shutdown, for OpenSSL versions >= 1.0.2 and
< 1.1.0 (#10795).
use_future
compile error encountered on some standard
library implementations, by changing std::allocator<void>
use to a non-void template parameter.
getaddrinfo
by default on Apple OSes,
rather than emulation in terms of getipnodebyname
.
OPENSSL_NO_SSL3
feature test #define
(#11754).
SSL_CTX_clear_chain_certs
function, if available.
strncat
in the getaddrinfo
emulation and in the SSL wrapper's password handling.
CreateEventW
rather
than CreateEvent
(#11732).
ConnectEx
function are
mapped to their portable equivalents (#10744).
BOOST_ASIO_DISABLE_CONNECTEX
to allow use
of ConnectEx
to be explicitly disabled.
windows::object_handle
when there
are pending wait operations on destruction (#10624).
EINVAL
.
ssl::stream<>
bug that may result in spurious
'short read' errors.
ERR_remove_state
.
std::addressof
with g++
(#10982).
join_group
failures
as non-fatal.
std::endl
to ensure output is
flushed.
yield_context
object with asynchronous operations.
yield_context
to allow reentrant calls to the completion
handler from an initiating function.
kqueue
reactor so that it works on FreeBSD
(#10606).
kqueue
reactor which resulted
in spinning when using serial ports on Mac OS (#10496).
kqueue
reactor support for read-only file descriptors
(#10367).
/dev/poll
reactor
(#10350, #10572).
WSASocketW
, as WSASocketA
has been deprecated (#10534).
use_future
and spawn()
are not made available when including the asio.hpp
convenience
header (#10567).
asio::strand
as deprecated. Use asio::io_service::strand
instead.
kqueue
backend that was introduced
in Asio 1.10.2.
gcc
on AIX.
gcc
problem to do with anonymous enums
(#10042).
HANDLE
backend change to ignore ERROR_MORE_DATA
.
Instead, the error will be propagated as with any other (i.e. in an error_code
or thrown as a system_error
), and the number of bytes transferred
will be returned. For code that needs to handle partial messages, the
error_code
overload should be used (#10034).
signal_set
implementation's
signal number check (#9324).
SO_UPDATE_CONNECT_CONTEXT
is defined (#10016).
VerifyVersionInfo
rather than GetVersionEx
, as GetVersionEx
has
been deprecated.
asio::spawn()
to work correctly with new Boost.Coroutine
interface (#9442, #9928).
asio::spawn()
coroutines are correctly
unwound when cleaned up by the io_service
destructor (#9731).
io_service::wrap()
and strand::wrap()
(#9741).
ConnectEx
,
if available, for connection-oriented IP sockets.
io_service
backend for non-Windows (and non-IOCP
Windows) platforms to use a single condition variable per io_service
instance. This addresses a potential race condition when run_one()
is used from multiple threads.
boost::chrono
and std::chrono
clocks (#9662, #9778).
EV_CLEAR
handling in the kqueue backend,
to address other cases where the close()
system call may hang
on Mac OS X.
resolver_query_base::flags::operator~
(#9548).
select
reactor more efficient on Windows for large
numbers of sockets (#9528).
gcc
(#9550).
GetQueuedCompletionStatus
timeout workaround
on recent versions of Windows.
io_service
, strand
,
buffers, composed operations, timers, etc., should all work as normal.
cancel()
function is not supported for sockets.
Asynchronous operations may only be cancelled by closing the socket.
null_buffers
are not supported.
tcp::no_delay
and socket_base::keep_alive
options are supported.
async_connect
were not correctly propagated through
to the completion handler (#8795).
io_service
. When the
bug occurs, the result of an asynchronous operation (error and bytes tranferred)
is incorrectly discarded and zero values used instead. For TCP sockets
this results in spurious end-of-file notifications (#8933).
async_wait
on a signal that is already raised
(#8738).
async_write_at
operations (#8669).
HANDLE
backend to treat ERROR_MORE_DATA
as a non-fatal error when returned by GetOverlappedResult
for a synchronous read (#8722).
generic
as a keyword. Added
a workaround that renames the namespace to cpp_generic
when
those language extensions are in effect.
async_result
support in Boost 1.54. In particular, the buffered stream templates have
been updated so that they adhere to current handler patterns (#9000,
#9001).
use_future
support for Microsoft Visual Studio 2012.
std::min
in the Windows IOCP backend to avoid
a dependency on the <algorithm>
header (#8758).
SSL_CTX_clear_options
function (#9273).
handler_type
and async_result
,
that allow the customisation of the return type of an initiating function.
asio::spawn()
function, a high-level wrapper for
running stackful coroutines, based on the Boost.Coroutine library. The
spawn()
function enables programs to implement asynchronous
logic in a synchronous manner. For example: size_t n = my_socket.async_read_some(my_buffer,
yield);
. For further information, see Stackful
Coroutines.
asio::use_future
special value, which provides first-class
support for returning a C++11 std::future
from an asynchronous
operation's initiating function. For example: future<size_t>
= my_socket.async_read_some(my_buffer, asio::use_future);
. For further
information, see C++
2011 Support - Futures.
asio_handler_is_continuation
.
Asynchronous operations may represent a continuation of the asynchronous
control flow associated with the current executing handler. The asio_handler_is_continuation
hook can be customised to return true
if this is the case,
and Asio's implementation can use this knowledge to optimise scheduling
of the new handler. To cover common cases, Asio customises the hook for
strands, spawn()
and composed asynchronous operations.
generic::datagram_protocol
,
generic::raw_protocol
, generic::seq_packet_protocol
and generic::stream_protocol
, which implement the Protocol
type requirements, but allow the user to specify the address family (e.g.
AF_INET
) and protocol type (e.g. IPPROTO_TCP
)
at runtime. For further information, see Support
for Other Protocols.
ip::tcp::socket
can be converted into a generic::stream_protocol::socket
via
move construction. For further information, see Support
for Other Protocols.
basic_socket_acceptor<>
's accept()
and async_accept()
functions to allow a new connection to
be accepted directly into a socket of a more generic type. For example,
an ip::tcp::acceptor
can be used to accept into a generic::stream_protocol::socket
object. For further information, see Support
for Other Protocols.
ssl::stream<>
class's handshake()
and async_handshake()
functions have been added. These accept a ConstBufferSequence
to be used as initial input to the ssl engine for the handshake procedure.
ssl::context
objects.
set_verify_depth()
function to the ssl::context
and ssl::stream<>
classes.
add_certificate_authority()
,
use_certificate()
, use_certificate_chain()
,
use_private_key()
, use_rsa_private_key()
and use_tmp_dh()
, have been added to the ssl::context
class.
ssl::context
to automatically disable SSL compression
by default. To enable, use the new ssl::context::clear_options()
function, as in my_context.clear_options(ssl::context::no_compression)
.
signal_set
implementation.
#warning
directive #7939.
epoll
implementation.
error_code
with an invalid (i.e. NULL
) error_category
#8613.
basic_waitable_timer
's underlying implementation so
that it can handle any time_point
value without overflowing
the intermediate duration objects.
run()
and poll()
on the same io_service
object #8354.
ssl::rfc2818_verification
class.
boost/asio/detail/winsock_init.hpp
for details.
basic_socket::get_option
's
documentation (#7562).
long
rather than int
for SSL_CTX
options, to match OpenSSL (#7209).
_snwprintf
to address a compile error due to
the changed swprintf
signature in recent versions of MinGW
(#7373).
io_service
threads due to running out of work (#7552).
noexcept
qualifier for error categories (#7797).
accept
as non-fatal (#7488).
ip::tcp::iostream
and C++11
(#7162).
#include <cctype>
, needed for some versions
of MinGW.
gcc
's atomic builtins on ARM CPUs, when
available (#7140).
io_service
has been destroyed.
epoll_create1()
function but always fail with ENOSYS
(#7012).
buffered_write_stream
(#6310).
epoll_reactor
backend to do lazy registration
for EPOLLOUT
events.
epoll_reactor
handling of out-of-band data, which
was broken by an incomplete fix in the last release.
OPENSSL_NO_ENGINE
feature test #define
(#6432).
windows::object_handle
so that it works with Windows
compilers that support C++11 move semantics (such as g++
).
g++
4.7 when compiling in C++11 mode
(#6620).
signal_set
handlers were not being delivered
when the io_service
was constructed with a concurrency_hint
of 1 (#6657).
basic_waitable_timer
based around
the C++11 clock type requirements. It may be used with the clocks from
the C++11 <chrono>
library facility or, if those are
not available, Boost.Chrono. The typedefs high_resolution_timer
,
steady_timer
and system_timer
may be used to
create timer objects for the standard clock types.
windows::object_handle
class for performing waits
on Windows kernel objects. Thanks go to Boris Schaeling for contributing
substantially to the development of this feature.
connect()
can return EAGAIN in certain circumstances.
Remapped this to another error so that it doesn't look like a non-blocking
operation (#6048).
buffered_write_stream
(#6310).
io_service
is repeatedly run without anything to do (#6321).
concurrency_hint
is 1) to eliminate a lock/unlock
pair.
epoll_reactor
speculative operations to
be performed without holding the lock.
epoll_reactor
's
I/O operation immediately before the corresponding handler is called.
This also improves scalability across CPUs when multiple threads
are running the io_service
.
boost::array
or std::array
)
of exactly two buffers.
async_read_until
(#5688).
signal()
function from the global namespace (#5722).
deadline_timer
implementation so that it does
not read the clock unless the timer heap is non-empty.
null_buffers
operations
so that they obey the user's non-blocking setting (#5756).
fd_set
at runtime when
using Windows.
epoll_reactor
initialisation
(#6006).
BOOST_ASIO_STRAND_IMPLEMENTATIONS
to the desired number.
BOOST_ASIO_ENABLE_SEQUENTIAL_STRAND_ALLOCATION
flag which switches the allocation of strand implementations to use a round-robin
approach rather than hashing.
strand.post()
is used.
signal_set
.
Programs may add one or more signals to the set, and then perform an async_wait()
operation. The specified handler will be called when one of the signals
occurs. The same signal number may be registered with multiple signal_set
objects, however the signal number must be used only with Asio. Addresses
#2879.
BOOST_ASIO_ENABLE_HANDLER_TRACKING
, Asio writes debugging
output to the standard error stream. The output records asynchronous operations
and the relationships between their handlers. It may be post-processed
using the included handlerviz.pl
tool to create a visual
representation of the handlers (requires GraphViz).
ip::tcp::iostream
.
A timeout is set by calling expires_at()
or expires_from_now()
to establish a deadline. Any socket operations which occur past the deadline
will put the iostream into a bad state.
error()
member function to socket iostreams, for
retrieving the error code from the most recent system call.
basic_deadline_timer::cancel_one()
function. This
function lets you cancel a single waiting handler on a timer. Handlers
are cancelled in FIFO order.
transfer_exactly()
completion condition. This
can be used to send or receive a specified number of bytes even if the
total size of the buffer (or buffer sequence) is larger.
connect()
and async_connect()
.
These operations try each endpoint in a list until the socket is successfully
connected, and are useful for creating TCP clients that work with both
IPv4 and IPv6.
buffer_size()
function so that it works for buffer
sequences in addition to individual buffers.
buffer_copy()
function that can be used to copy
the raw bytes between individual buffers and buffer sequences.
read()
, read_at()
,
write()
and write_at()
that do not require a
completion condition.
g++
4.5 or later, and MSVC 10), static_assert
is also used to generate an informative error message. This checking may
be disabled by defining BOOST_ASIO_DISABLE_HANDLER_TYPE_REQUIREMENTS
.
BOOST_ASIO_ENABLE_OLD_SSL
. Addresses #3702,
#3958.
boost/asio/ssl/impl/src.hpp
in one
source file in your program.
is_loopback()
, is_unspecified()
and
is_multicast()
functions consistently available across the
ip::address
, ip::address_v4
and ip::address_v6
classes (#3939).
non_blocking()
functions for managing the non-blocking
behaviour of a socket or descriptor. The io_control()
commands
named non_blocking_io
are now deprecated in favour of these
new functions.
native_non_blocking()
functions for managing the
non-blocking mode of the underlying socket or descriptor. These functions
are intended to allow the encapsulation of arbitrary non-blocking system
calls as asynchronous operations, in a way that is transparent to the user
of the socket object. The functions have no effect on the behaviour of
the synchronous operations of the socket or descriptor.
io_control()
member function for socket acceptors
(#3297).
release()
member function to posix descriptors. This
function releases ownership of the underlying native descriptor to the
caller. Addresses #3900.
SOCK_SEQPACKET
).
io_service::stopped()
function that can be used
to determine whether the io_service
has stopped (i.e. a reset()
call is needed prior to any further calls to run()
, run_one()
,
poll()
or poll_one()
).
native_type
typedefs in favour of native_handle_type
, and the native()
member functions in favour of native_handle()
.
fork()
system call. Programs that use
fork()
must call io_service.notify_fork()
at
the appropriate times. Two new examples have been added showing how to
use this feature. Addresses #3238,
#4162.
close()
system call. In particular, assume that most operating systems won't have
close()
fail with EWOULDBLOCK
, but if it does
then set the blocking mode and restart the call. If any other error occurs,
assume the descriptor is closed. Addresses #3307.
asio::buffer()
overloads for std::array
,
when available.
array
, shared_ptr
, weak_ptr
and
atomic
when they are available, rather than the Boost equivalents.
what()
messages.
shutdown_service()
member functions to be private.
ip::basic_endpoint<>
objects (such
as ip::tcp::endpoint
and ip::udp::endpoint
).
assign()
may have been dup()
-ed,
and so require explicit deregistration from the reactor (#4971).
io_service()
.
The get_io_service()
member functions should be used instead.
resolver_query
and resolver_iterator
from the ip::tcp
, ip::udp
and ip::icmp
classes.
buffers_iterator<>
and ip::basic_resolver_iterator
classes so that the value_type typedefs are non-const byte types.
-Wshadow
compiler option
(#3905).
FIONBIO
constant to
int, to suppress a compiler warning on some platforms (#5128).
tick_count_timer
example by making
the duration type signed. Previously, a wait on an already-passed deadline
would not return for a very long time (#5418).
EV_ONESHOT
seems to cause problems on some versions of Mac
OS X, with the io_service
destructor getting stuck inside
the close()
system call. Changed the kqueue backend to use
EV_CLEAR
instead (#5021).
g++
due
to the use of anonymous enums (#4883).
EWOULDBLOCK
are not correctly re-registered with
kqueue.
asio::streambuf
to ensure that its internal pointers
are updated correctly after the data has been modified using std::streambuf
member functions.
ip::address_v4::broadcast()
is used on 64-bit platforms.
deadline_timer
may never fire if the io_service
is running in a background
thread (#4568).
has_service<>
from compiling (#4638).
close()
/closesocket()
failures are correctly
propagated (#4573).
InitializeCriticalSectionAndSpinCount
(#4574).
pselect()
on HP-UX, if it is available (#4578).
deadline_timer
objects
with expiry times set more than 5 minutes in the future may never expire
(#4745).
resolver
backend on BSD platforms so that an empty
service name resolves to port number 0
, as per the documentation
(#4690).
const_buffers_1
(#4746).
Protocol
and id
to avoid clashing with
Objective-C++ keywords (#4191).
vector
reallocation performance issue that can occur
when there are many active deadline_timer
objects (#4780).
io_control()
implementation on 64-bit Mac
OS X and BSD platforms (#4782).
accept()
are incorrectly treated as successes (#4859).
<boost/asio/impl/src.cpp>
in favour of <boost/asio/impl/src.hpp>
(#4560).
#include
s, e.g. if the program uses boost::array
but does not explicitly include <boost/array.hpp>
.)
deadline_timer
implementation to improve performance.
asio::streambuf
with async_read()
and async_read_until()
. These read operations now use the
existing capacity of the streambuf
when reading, rather than
limiting the read to 512 bytes.
#include <boost/asio/impl/src.cpp>
to one source file in a program, then build the program with BOOST_ASIO_SEPARATE_COMPILATION
defined in the project/compiler settings. Alternatively, BOOST_ASIO_DYN_LINK
may be defined to build a separately-compiled Asio as part of a shared
library.
BOOST_ASIO_DISABLE_FENCED_BLOCK
to permit
the disabling of memory fences around completion handlers, even if thread
support is enabled.
const
types.
null_buffers
variant of
async_send_to
(#4170).
unsigned char
is used with isdigit
in
getaddrinfo
emulation (#4201).
operator+
overload in buffers_iterator
(#4382).
null_buffers
operations on Windows.
timerfd
for dispatching timers on Linux, when
available.
ip::resolver_query_base::flags
as per
the TR2 proposal. This type prevents implicit conversion from int
to flags
, allowing the compiler to catch cases where users
incorrectly pass a numeric port number as the service name.
#define NOMINMAX
for all Windows compilers. Users can
define BOOST_ASIO_NO_NOMINMAX
to suppress this definition
(#3901).
error::eof
result to the completion handler (#4023).
io_control()
member functions to always call
ioctl
on the underlying descriptor when modifying blocking
mode (#3307).
InternetProtocol::resolver_query
and InternetProtocol::resolver_iterator
, as neither typedef
is part of the documented InternetProtocol
requirements. The
corresponding typedefs in the ip::tcp
, ip::udp
and ip::icmp
classes have been deprecated.
select()
.
BOOST_ASIO_DISABLE_THREADS
macro that allows Asio's
threading support to be independently disabled.
boost::addressof
to get the address of handler objects, rather than applying operator&
directly (#2977).
OVERLAPPED
structure to be valid until both the initiating
function call has returned and the completion packet has been delivered.
boost_
prefix to the extern "C"
thread entry point function (#3809).
getaddrinfo
emulation, only check the socket type (SOCK_STREAM
or SOCK_DGRAM
) if a service name has been specified. This
should allow the emulation to work with raw sockets.
buffered*_stream<>
templates to treat 0-byte
reads and writes as no-ops, to comply with the documented type requirements
for SyncReadStream
, AsyncReadStream
, SyncWriteStream
and AsyncWriteStream
.
throw
keyword to boost::throw_exception()
to allow Asio to be used when exception support is disabled. Note that
the SSL wrappers still require exception support (#2754).
/dev/poll
backend.
_GLIBCXX_DEBUG
is defined (#3098).
BOOST_ASIO_HASH_MAP_BUCKETS
may be used to tweak the sizes used for the bucket arrays. (N.B. this feature
introduced a bug which was fixed in Asio 1.4.3 / Boost 1.40.)
io_control()
so that it adheres
to the documented type requirements for IoControlCommand (#2820).
ReadFile
call fails with ERROR_MORE_DATA
. This enables a hack where
a windows::stream_handle
can be used with a message-oriented
named pipe (#2936).
BOOST_ASIO_DISABLE_SERIAL_PORT
is defined (#2917).
windows::overlapped_ptr::complete()
are
correctly passed to the completion handler (#2614).
size_t CompletionCondition(error_code
ec, size_t total)
, where the return value indicates the maximum
number of bytes to be transferred on the next read or write operation.
(The old CompletionCondition signature is still supported for backwards
compatibility).
HANDLE
s such as
named pipes (requires HANDLE
s that work with I/O completion
ports).
HANDLE
s such as files
(requires HANDLE
s that work with I/O completion ports).
null_buffers
type.
read_until()
and async_read_until()
overloads that take a user-defined function object for locating message
boundaries.
BOOST_ASIO_ENABLE_TWO_LOCK_QUEUE
)
that may provide better io_service
scalability across many
processors.
First release of Asio as part of Boost.