diff --git a/asio/asio/.gitignore b/asio/asio/.gitignore deleted file mode 100644 index 55db11878..000000000 --- a/asio/asio/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -Makefile -Makefile.in -aclocal.m4 -autom4te.cache -compile -config.guess -config.log -config.status -config.sub -configure -depcomp -install-sh -missing -test-driver -/doc -/lib -/boostified -/tsified -*.gz -*.bz2 -*.zip -/*.cpp -/*.hpp diff --git a/asio/asio/README b/asio/asio/README index 661e72670..14a3eb5b1 100644 --- a/asio/asio/README +++ b/asio/asio/README @@ -2,3 +2,14 @@ asio version 1.12.0 Released Sunday, 04 March 2018. See doc/index.html for API documentation and a tutorial. + +To boostify asio for wolfSSL compatibility with Boost.asio do as follows: + +Run the command `./boostify.pl` in `asio/asio`. + +The boostified version of asio is now located in `asio/asio/boostified/libs/asio/include/boost`. + +Replace the asio folder in your Boost download with this boostified version of asio. + +Compile Boost. + diff --git a/asio/asio/configure.ac b/asio/asio/configure.ac new file mode 100644 index 000000000..813b6a23a --- /dev/null +++ b/asio/asio/configure.ac @@ -0,0 +1,208 @@ +AC_INIT(asio, [1.12.0]) +AC_CONFIG_SRCDIR(include/asio.hpp) +AM_MAINTAINER_MODE +AM_INIT_AUTOMAKE([tar-ustar]) + +AC_CANONICAL_HOST +AM_PROG_CC_C_O +AC_PROG_CXX +AC_LANG(C++) +AC_PROG_RANLIB + +AC_DEFINE(_REENTRANT, [1], [Define this]) + +AC_ARG_WITH(boost, + AC_HELP_STRING([--with-boost=DIR],[location of boost distribution]), +[ + if test "${withval}" = no; then + STANDALONE="yes" + else + CPPFLAGS="$CPPFLAGS -I${withval} -DBOOST_CHRONO_HEADER_ONLY -DBOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING" + LIBS="$LIBS -L${withval}/stage/lib" + fi +], +[ + BOOSTDIR=`ls -1d ../boost_*_*_*/ 2>/dev/null | sort -t "_" -k 2nr -k 3nr -k 4nr | head -n 1 | sed -e 's/\/$//'` + if test "${BOOSTDIR}" != ""; then + BOOSTDIR="`pwd`/${BOOSTDIR}" + if test -d "${BOOSTDIR}"; then + echo "using automatically detected boost from ${BOOSTDIR}" + CPPFLAGS="$CPPFLAGS -I${BOOSTDIR} -DBOOST_CHRONO_HEADER_ONLY -DBOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING" + LIBS="$LIBS -L${BOOSTDIR}/stage/lib" + fi + fi +]) + +AC_ARG_ENABLE(separate-compilation, +[ --enable-separate-compilation separate compilation of asio source], +[ + SEPARATE_COMPILATION=yes +]) + +AC_ARG_ENABLE(boost-coroutine, +[ --enable-boost-coroutine use Boost.Coroutine to implement stackful coroutines], +[ + HAVE_BOOST_COROUTINE=yes +]) + +if test "$STANDALONE" != yes; then + AC_CHECK_HEADER([boost/noncopyable.hpp],, + [ + echo "Can't find boost headers. Please check the location of the boost" + echo "distribution and rerun configure using the --with-boost=DIR option." + echo "Alternatively, run with --without-boost to enable standalone build." + exit 1 + ],[]) +fi + +# Allows use of unit tests with wolfSSL instead of OpenSSL +AC_ARG_WITH(wolfssl, + AC_HELP_STRING([--with-wolfssl=DIR],[location of wolfssl]), +[ + CPPFLAGS="$CPPFLAGS -I${withval}/include/wolfssl -DASIO_USE_WOLFSSL" + LIBS="$LIBS -L${withval}/lib" + WOLFSSL_USE=no +],[]) + +if test x$WOLFSSL_USE == xno; then + AC_CHECK_HEADER([wolfssl/options.h],, + [ + WOLFSSL_FOUND=no + ],[]) + + if test x$WOLFSSL_FOUND != xno; then + LIBS="$LIBS -lwolfssl" + fi + AM_CONDITIONAL(HAVE_OPENSSL,test x$WOLFSSL_FOUND != xno) +fi + +AC_ARG_WITH(openssl, + AC_HELP_STRING([--with-openssl=DIR],[location of openssl]), +[ + CPPFLAGS="$CPPFLAGS -I${withval}/include" + LIBS="$LIBS -L${withval}/lib" +],[]) + +# Link OpenSSL libs if wolfSSL is not being used +if test x$WOLFSSL_USE != xno; then + AC_CHECK_HEADER([openssl/ssl.h],, + [ + OPENSSL_FOUND=no + ],[]) + + if test x$OPENSSL_FOUND != xno; then + LIBS="$LIBS -lssl -lcrypto" + fi + AM_CONDITIONAL(HAVE_OPENSSL,test x$OPENSSL_FOUND != xno) +fi + +WINDOWS=no +case $host in + *-*-linux*) + CXXFLAGS="$CXXFLAGS -pthread" + LDFLAGS="$LDFLAGS -pthread" + LIBS="$LIBS -lrt" + ;; + *-*-solaris*) + if test "$GXX" = yes; then + CXXFLAGS="$CXXFLAGS -D_PTHREADS" + else + # We'll assume Sun's CC. + CXXFLAGS="$CXXFLAGS -mt" + fi + LIBS="$LIBS -lsocket -lnsl -lpthread" + ;; + *-*-mingw32*) + CXXFLAGS="$CXXFLAGS -mthreads" + LDFLAGS="$LDFLAGS -mthreads" + LIBS="$LIBS -lws2_32 -lmswsock" + WINDOWS=yes + ;; + *-*-mingw64*) + CXXFLAGS="$CXXFLAGS -mthreads" + LDFLAGS="$LDFLAGS -mthreads" + LIBS="$LIBS -lws2_32 -lmswsock" + WINDOWS=yes + ;; + *-pc-cygwin*) + CXXFLAGS="$CXXFLAGS -D__USE_W32_SOCKETS -D_WIN32_WINNT=0x0501" + LIBS="$LIBS -lws2_32 -lmswsock" + WINDOWS=yes + ;; + *-apple-darwin*) + CXXFLAGS="$CXXFLAGS" + LDFLAGS="$LDFLAGS" + ;; + *-*-freebsd*) + CXXFLAGS="$CXXFLAGS -pthread" + LDFLAGS="$LDFLAGS -pthread" + ;; + *-*-netbsd*) + CXXFLAGS="$CXXFLAGS -pthread" + LDFLAGS="$LDFLAGS -pthread" + ;; +esac + +if test "$GXX" = yes; then + CXXFLAGS="$CXXFLAGS -ftemplate-depth-256" +fi + +if test "$STANDALONE" = yes; then + CPPFLAGS="$CPPFLAGS -DASIO_STANDALONE" +fi + +if test "$SEPARATE_COMPILATION" = yes; then + CPPFLAGS="$CPPFLAGS -DASIO_SEPARATE_COMPILATION" +fi + +AC_MSG_CHECKING([whether C++11 is enabled]) +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#if __cplusplus < 201103L]] + [[#error C++11 not available]] + [[#endif]])], + [AC_MSG_RESULT([yes]) + HAVE_CXX11=yes;], + [AC_MSG_RESULT([no]) + HAVE_CXX11=no;]) + +AC_MSG_CHECKING([whether C++14 is enabled]) +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#if __cplusplus < 201402L]] + [[#error C++14 not available]] + [[#endif]])], + [AC_MSG_RESULT([yes]) + HAVE_CXX14=yes;], + [AC_MSG_RESULT([no]) + HAVE_CXX14=no;]) + +if test "$GXX" = yes; then + if test "$STANDALONE" = yes; then + if test "$HAVE_CXX11" = no; then + HAVE_CXX11=yes + CPPFLAGS="-std=c++0x $CPPFLAGS" + fi + fi +fi + +AM_CONDITIONAL(STANDALONE,test x$STANDALONE = xyes) + +AM_CONDITIONAL(SEPARATE_COMPILATION,test x$SEPARATE_COMPILATION = xyes) + +AM_CONDITIONAL(HAVE_BOOST_COROUTINE,test x$HAVE_BOOST_COROUTINE = xyes) + +AM_CONDITIONAL(WINDOWS_TARGET,test x$WINDOWS != xno) + +AM_CONDITIONAL(HAVE_CXX11,test x$HAVE_CXX11 = xyes) + +AM_CONDITIONAL(HAVE_CXX14,test x$HAVE_CXX14 = xyes) + +AC_OUTPUT([ + Makefile + include/Makefile + src/Makefile + src/tests/Makefile + src/examples/cpp03/Makefile + src/examples/cpp11/Makefile + src/examples/cpp14/Makefile]) diff --git a/asio/asio/include/asio/detail/config.hpp b/asio/asio/include/asio/detail/config.hpp new file mode 100644 index 000000000..cde334e81 --- /dev/null +++ b/asio/asio/include/asio/detail/config.hpp @@ -0,0 +1,1437 @@ +// +// detail/config.hpp +// ~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2018 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) +// + +#ifndef ASIO_DETAIL_CONFIG_HPP +#define ASIO_DETAIL_CONFIG_HPP + +#if defined(ASIO_STANDALONE) +# define ASIO_DISABLE_BOOST_ARRAY 1 +# define ASIO_DISABLE_BOOST_ASSERT 1 +# define ASIO_DISABLE_BOOST_BIND 1 +# define ASIO_DISABLE_BOOST_CHRONO 1 +# define ASIO_DISABLE_BOOST_DATE_TIME 1 +# define ASIO_DISABLE_BOOST_LIMITS 1 +# define ASIO_DISABLE_BOOST_REGEX 1 +# define ASIO_DISABLE_BOOST_STATIC_CONSTANT 1 +# define ASIO_DISABLE_BOOST_THROW_EXCEPTION 1 +# define ASIO_DISABLE_BOOST_WORKAROUND 1 +#else // defined(ASIO_STANDALONE) +# include +# include +# define ASIO_HAS_BOOST_CONFIG 1 +#endif // defined(ASIO_STANDALONE) + +// Default to a header-only implementation. The user must specifically request +// separate compilation by defining either ASIO_SEPARATE_COMPILATION or +// ASIO_DYN_LINK (as a DLL/shared library implies separate compilation). +#if !defined(ASIO_HEADER_ONLY) +# if !defined(ASIO_SEPARATE_COMPILATION) +# if !defined(ASIO_DYN_LINK) +# define ASIO_HEADER_ONLY 1 +# endif // !defined(ASIO_DYN_LINK) +# endif // !defined(ASIO_SEPARATE_COMPILATION) +#endif // !defined(ASIO_HEADER_ONLY) + +#if defined(ASIO_HEADER_ONLY) +# define ASIO_DECL inline +#else // defined(ASIO_HEADER_ONLY) +# if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__CODEGEARC__) +// We need to import/export our code only if the user has specifically asked +// for it by defining ASIO_DYN_LINK. +# if defined(ASIO_DYN_LINK) +// Export if this is our own source, otherwise import. +# if defined(ASIO_SOURCE) +# define ASIO_DECL __declspec(dllexport) +# else // defined(ASIO_SOURCE) +# define ASIO_DECL __declspec(dllimport) +# endif // defined(ASIO_SOURCE) +# endif // defined(ASIO_DYN_LINK) +# endif // defined(_MSC_VER) || defined(__BORLANDC__) || defined(__CODEGEARC__) +#endif // defined(ASIO_HEADER_ONLY) + +// If ASIO_DECL isn't defined yet define it now. +#if !defined(ASIO_DECL) +# define ASIO_DECL +#endif // !defined(ASIO_DECL) + +// Microsoft Visual C++ detection. +#if !defined(ASIO_MSVC) +# if defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_MSVC) +# define ASIO_MSVC BOOST_MSVC +# elif defined(_MSC_VER) && (defined(__INTELLISENSE__) \ + || (!defined(__MWERKS__) && !defined(__EDG_VERSION__))) +# define ASIO_MSVC _MSC_VER +# endif // defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_MSVC) +#endif // !defined(ASIO_MSVC) +#if defined(ASIO_MSVC) +# include // Needed for _HAS_CXX17. +#endif // defined(ASIO_MSVC) + +// Clang / libc++ detection. +#if defined(__clang__) +# if (__cplusplus >= 201103) +# if __has_include(<__config>) +# include <__config> +# if defined(_LIBCPP_VERSION) +# define ASIO_HAS_CLANG_LIBCXX 1 +# endif // defined(_LIBCPP_VERSION) +# endif // __has_include(<__config>) +# endif // (__cplusplus >= 201103) +#endif // defined(__clang__) + +// Android platform detection. +#if defined(__ANDROID__) +# include +#endif // defined(__ANDROID__) + +// Support move construction and assignment on compilers known to allow it. +#if !defined(ASIO_HAS_MOVE) +# if !defined(ASIO_DISABLE_MOVE) +# if defined(__clang__) +# if __has_feature(__cxx_rvalue_references__) +# define ASIO_HAS_MOVE 1 +# endif // __has_feature(__cxx_rvalue_references__) +# endif // defined(__clang__) +# if defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define ASIO_HAS_MOVE 1 +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4) +# endif // defined(__GNUC__) +# if defined(ASIO_MSVC) +# if (_MSC_VER >= 1700) +# define ASIO_HAS_MOVE 1 +# endif // (_MSC_VER >= 1700) +# endif // defined(ASIO_MSVC) +# endif // !defined(ASIO_DISABLE_MOVE) +#endif // !defined(ASIO_HAS_MOVE) + +// If ASIO_MOVE_CAST isn't defined, and move support is available, define +// ASIO_MOVE_ARG and ASIO_MOVE_CAST to take advantage of rvalue +// references and perfect forwarding. +#if defined(ASIO_HAS_MOVE) && !defined(ASIO_MOVE_CAST) +# define ASIO_MOVE_ARG(type) type&& +# define ASIO_MOVE_ARG2(type1, type2) type1, type2&& +# define ASIO_MOVE_CAST(type) static_cast +# define ASIO_MOVE_CAST2(type1, type2) static_cast +#endif // defined(ASIO_HAS_MOVE) && !defined(ASIO_MOVE_CAST) + +// If ASIO_MOVE_CAST still isn't defined, default to a C++03-compatible +// implementation. Note that older g++ and MSVC versions don't like it when you +// pass a non-member function through a const reference, so for most compilers +// we'll play it safe and stick with the old approach of passing the handler by +// value. +#if !defined(ASIO_MOVE_CAST) +# if defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)) || (__GNUC__ > 4) +# define ASIO_MOVE_ARG(type) const type& +# else // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)) || (__GNUC__ > 4) +# define ASIO_MOVE_ARG(type) type +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)) || (__GNUC__ > 4) +# elif defined(ASIO_MSVC) +# if (_MSC_VER >= 1400) +# define ASIO_MOVE_ARG(type) const type& +# else // (_MSC_VER >= 1400) +# define ASIO_MOVE_ARG(type) type +# endif // (_MSC_VER >= 1400) +# else +# define ASIO_MOVE_ARG(type) type +# endif +# define ASIO_MOVE_CAST(type) static_cast +# define ASIO_MOVE_CAST2(type1, type2) static_cast +#endif // !defined(ASIO_MOVE_CAST) + +// Support variadic templates on compilers known to allow it. +#if !defined(ASIO_HAS_VARIADIC_TEMPLATES) +# if !defined(ASIO_DISABLE_VARIADIC_TEMPLATES) +# if defined(__clang__) +# if __has_feature(__cxx_variadic_templates__) +# define ASIO_HAS_VARIADIC_TEMPLATES 1 +# endif // __has_feature(__cxx_variadic_templates__) +# endif // defined(__clang__) +# if defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define ASIO_HAS_VARIADIC_TEMPLATES 1 +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4) +# endif // defined(__GNUC__) +# if defined(ASIO_MSVC) +# if (_MSC_VER >= 1900) +# define ASIO_HAS_VARIADIC_TEMPLATES 1 +# endif // (_MSC_VER >= 1900) +# endif // defined(ASIO_MSVC) +# endif // !defined(ASIO_DISABLE_VARIADIC_TEMPLATES) +#endif // !defined(ASIO_HAS_VARIADIC_TEMPLATES) + +// Support deleted functions on compilers known to allow it. +#if !defined(ASIO_DELETED) +# if defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define ASIO_DELETED = delete +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4) +# endif // defined(__GNUC__) +# if defined(__clang__) +# if __has_feature(__cxx_deleted_functions__) +# define ASIO_DELETED = delete +# endif // __has_feature(__cxx_deleted_functions__) +# endif // defined(__clang__) +# if defined(ASIO_MSVC) +# if (_MSC_VER >= 1900) +# define ASIO_DELETED = delete +# endif // (_MSC_VER >= 1900) +# endif // defined(ASIO_MSVC) +# if !defined(ASIO_DELETED) +# define ASIO_DELETED +# endif // !defined(ASIO_DELETED) +#endif // !defined(ASIO_DELETED) + +// Support constexpr on compilers known to allow it. +#if !defined(ASIO_HAS_CONSTEXPR) +# if !defined(ASIO_DISABLE_CONSTEXPR) +# if defined(__clang__) +# if __has_feature(__cxx_constexpr__) +# define ASIO_HAS_CONSTEXPR 1 +# endif // __has_feature(__cxx_constexr__) +# endif // defined(__clang__) +# if defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define ASIO_HAS_CONSTEXPR 1 +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4) +# endif // defined(__GNUC__) +# if defined(ASIO_MSVC) +# if (_MSC_VER >= 1900) +# define ASIO_HAS_CONSTEXPR 1 +# endif // (_MSC_VER >= 1900) +# endif // defined(ASIO_MSVC) +# endif // !defined(ASIO_DISABLE_CONSTEXPR) +#endif // !defined(ASIO_HAS_CONSTEXPR) +#if !defined(ASIO_CONSTEXPR) +# if defined(ASIO_HAS_CONSTEXPR) +# define ASIO_CONSTEXPR constexpr +# else // defined(ASIO_HAS_CONSTEXPR) +# define ASIO_CONSTEXPR +# endif // defined(ASIO_HAS_CONSTEXPR) +#endif // !defined(ASIO_CONSTEXPR) + +// Support noexcept on compilers known to allow it. +#if !defined(ASIO_NOEXCEPT) +# if !defined(ASIO_DISABLE_NOEXCEPT) +# if (BOOST_VERSION >= 105300) +# define ASIO_NOEXCEPT BOOST_NOEXCEPT +# define ASIO_NOEXCEPT_OR_NOTHROW BOOST_NOEXCEPT_OR_NOTHROW +# elif defined(__clang__) +# if __has_feature(__cxx_noexcept__) +# define ASIO_NOEXCEPT noexcept(true) +# define ASIO_NOEXCEPT_OR_NOTHROW noexcept(true) +# endif // __has_feature(__cxx_noexcept__) +# elif defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define ASIO_NOEXCEPT noexcept(true) +# define ASIO_NOEXCEPT_OR_NOTHROW noexcept(true) +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4) +# elif defined(ASIO_MSVC) +# if (_MSC_VER >= 1900) +# define ASIO_NOEXCEPT noexcept(true) +# define ASIO_NOEXCEPT_OR_NOTHROW noexcept(true) +# endif // (_MSC_VER >= 1900) +# endif // defined(ASIO_MSVC) +# endif // !defined(ASIO_DISABLE_NOEXCEPT) +# if !defined(ASIO_NOEXCEPT) +# define ASIO_NOEXCEPT +# endif // !defined(ASIO_NOEXCEPT) +# if !defined(ASIO_NOEXCEPT_OR_NOTHROW) +# define ASIO_NOEXCEPT_OR_NOTHROW throw() +# endif // !defined(ASIO_NOEXCEPT_OR_NOTHROW) +#endif // !defined(ASIO_NOEXCEPT) + +// Support automatic type deduction on compilers known to support it. +#if !defined(ASIO_HAS_DECLTYPE) +# if !defined(ASIO_DISABLE_DECLTYPE) +# if defined(__clang__) +# if __has_feature(__cxx_decltype__) +# define ASIO_HAS_DECLTYPE 1 +# endif // __has_feature(__cxx_decltype__) +# endif // defined(__clang__) +# if defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define ASIO_HAS_DECLTYPE 1 +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4) +# endif // defined(__GNUC__) +# if defined(ASIO_MSVC) +# if (_MSC_VER >= 1700) +# define ASIO_HAS_DECLTYPE 1 +# endif // (_MSC_VER >= 1700) +# endif // defined(ASIO_MSVC) +# endif // !defined(ASIO_DISABLE_DECLTYPE) +#endif // !defined(ASIO_HAS_DECLTYPE) + +// Support alias templates on compilers known to allow it. +#if !defined(ASIO_HAS_ALIAS_TEMPLATES) +# if !defined(ASIO_DISABLE_ALIAS_TEMPLATES) +# if defined(__clang__) +# if __has_feature(__cxx_alias_templates__) +# define ASIO_HAS_ALIAS_TEMPLATES 1 +# endif // __has_feature(__cxx_alias_templates__) +# endif // defined(__clang__) +# if defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define ASIO_HAS_ALIAS_TEMPLATES 1 +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4) +# endif // defined(__GNUC__) +# if defined(ASIO_MSVC) +# if (_MSC_VER >= 1900) +# define ASIO_HAS_ALIAS_TEMPLATES 1 +# endif // (_MSC_VER >= 1900) +# endif // defined(ASIO_MSVC) +# endif // !defined(ASIO_DISABLE_ALIAS_TEMPLATES) +#endif // !defined(ASIO_HAS_ALIAS_TEMPLATES) + +// Standard library support for system errors. +#if !defined(ASIO_HAS_STD_SYSTEM_ERROR) +# if !defined(ASIO_DISABLE_STD_SYSTEM_ERROR) +# if defined(__clang__) +# if defined(ASIO_HAS_CLANG_LIBCXX) +# define ASIO_HAS_STD_SYSTEM_ERROR 1 +# elif (__cplusplus >= 201103) +# if __has_include() +# define ASIO_HAS_STD_SYSTEM_ERROR 1 +# endif // __has_include() +# endif // (__cplusplus >= 201103) +# endif // defined(__clang__) +# if defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define ASIO_HAS_STD_SYSTEM_ERROR 1 +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4) +# endif // defined(__GNUC__) +# if defined(ASIO_MSVC) +# if (_MSC_VER >= 1700) +# define ASIO_HAS_STD_SYSTEM_ERROR 1 +# endif // (_MSC_VER >= 1700) +# endif // defined(ASIO_MSVC) +# endif // !defined(ASIO_DISABLE_STD_SYSTEM_ERROR) +#endif // !defined(ASIO_HAS_STD_SYSTEM_ERROR) + +// Compliant C++11 compilers put noexcept specifiers on error_category members. +#if !defined(ASIO_ERROR_CATEGORY_NOEXCEPT) +# if (BOOST_VERSION >= 105300) +# define ASIO_ERROR_CATEGORY_NOEXCEPT BOOST_NOEXCEPT +# elif defined(__clang__) +# if __has_feature(__cxx_noexcept__) +# define ASIO_ERROR_CATEGORY_NOEXCEPT noexcept(true) +# endif // __has_feature(__cxx_noexcept__) +# elif defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define ASIO_ERROR_CATEGORY_NOEXCEPT noexcept(true) +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4) +# elif defined(ASIO_MSVC) +# if (_MSC_VER >= 1900) +# define ASIO_ERROR_CATEGORY_NOEXCEPT noexcept(true) +# endif // (_MSC_VER >= 1900) +# endif // defined(ASIO_MSVC) +# if !defined(ASIO_ERROR_CATEGORY_NOEXCEPT) +# define ASIO_ERROR_CATEGORY_NOEXCEPT +# endif // !defined(ASIO_ERROR_CATEGORY_NOEXCEPT) +#endif // !defined(ASIO_ERROR_CATEGORY_NOEXCEPT) + +// Standard library support for arrays. +#if !defined(ASIO_HAS_STD_ARRAY) +# if !defined(ASIO_DISABLE_STD_ARRAY) +# if defined(__clang__) +# if defined(ASIO_HAS_CLANG_LIBCXX) +# define ASIO_HAS_STD_ARRAY 1 +# elif (__cplusplus >= 201103) +# if __has_include() +# define ASIO_HAS_STD_ARRAY 1 +# endif // __has_include() +# endif // (__cplusplus >= 201103) +# endif // defined(__clang__) +# if defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define ASIO_HAS_STD_ARRAY 1 +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4) +# endif // defined(__GNUC__) +# if defined(ASIO_MSVC) +# if (_MSC_VER >= 1600) +# define ASIO_HAS_STD_ARRAY 1 +# endif // (_MSC_VER >= 1600) +# endif // defined(ASIO_MSVC) +# endif // !defined(ASIO_DISABLE_STD_ARRAY) +#endif // !defined(ASIO_HAS_STD_ARRAY) + +// Standard library support for shared_ptr and weak_ptr. +#if !defined(ASIO_HAS_STD_SHARED_PTR) +# if !defined(ASIO_DISABLE_STD_SHARED_PTR) +# if defined(__clang__) +# if defined(ASIO_HAS_CLANG_LIBCXX) +# define ASIO_HAS_STD_SHARED_PTR 1 +# elif (__cplusplus >= 201103) +# define ASIO_HAS_STD_SHARED_PTR 1 +# endif // (__cplusplus >= 201103) +# endif // defined(__clang__) +# if defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define ASIO_HAS_STD_SHARED_PTR 1 +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4) +# endif // defined(__GNUC__) +# if defined(ASIO_MSVC) +# if (_MSC_VER >= 1600) +# define ASIO_HAS_STD_SHARED_PTR 1 +# endif // (_MSC_VER >= 1600) +# endif // defined(ASIO_MSVC) +# endif // !defined(ASIO_DISABLE_STD_SHARED_PTR) +#endif // !defined(ASIO_HAS_STD_SHARED_PTR) + +// Standard library support for allocator_arg_t. +#if !defined(ASIO_HAS_STD_ALLOCATOR_ARG) +# if !defined(ASIO_DISABLE_STD_ALLOCATOR_ARG) +# if defined(__clang__) +# if defined(ASIO_HAS_CLANG_LIBCXX) +# define ASIO_HAS_STD_ALLOCATOR_ARG 1 +# elif (__cplusplus >= 201103) +# define ASIO_HAS_STD_ALLOCATOR_ARG 1 +# endif // (__cplusplus >= 201103) +# endif // defined(__clang__) +# if defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define ASIO_HAS_STD_ALLOCATOR_ARG 1 +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4) +# endif // defined(__GNUC__) +# if defined(ASIO_MSVC) +# if (_MSC_VER >= 1600) +# define ASIO_HAS_STD_ALLOCATOR_ARG 1 +# endif // (_MSC_VER >= 1600) +# endif // defined(ASIO_MSVC) +# endif // !defined(ASIO_DISABLE_STD_ALLOCATOR_ARG) +#endif // !defined(ASIO_HAS_STD_ALLOCATOR_ARG) + +// Standard library support for atomic operations. +#if !defined(ASIO_HAS_STD_ATOMIC) +# if !defined(ASIO_DISABLE_STD_ATOMIC) +# if defined(__clang__) +# if defined(ASIO_HAS_CLANG_LIBCXX) +# define ASIO_HAS_STD_ATOMIC 1 +# elif (__cplusplus >= 201103) +# if __has_include() +# define ASIO_HAS_STD_ATOMIC 1 +# endif // __has_include() +# endif // (__cplusplus >= 201103) +# endif // defined(__clang__) +# if defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define ASIO_HAS_STD_ATOMIC 1 +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4) +# endif // defined(__GNUC__) +# if defined(ASIO_MSVC) +# if (_MSC_VER >= 1700) +# define ASIO_HAS_STD_ATOMIC 1 +# endif // (_MSC_VER >= 1700) +# endif // defined(ASIO_MSVC) +# endif // !defined(ASIO_DISABLE_STD_ATOMIC) +#endif // !defined(ASIO_HAS_STD_ATOMIC) + +// Standard library support for chrono. Some standard libraries (such as the +// libstdc++ shipped with gcc 4.6) provide monotonic_clock as per early C++0x +// drafts, rather than the eventually standardised name of steady_clock. +#if !defined(ASIO_HAS_STD_CHRONO) +# if !defined(ASIO_DISABLE_STD_CHRONO) +# if defined(__clang__) +# if defined(ASIO_HAS_CLANG_LIBCXX) +# define ASIO_HAS_STD_CHRONO 1 +# elif (__cplusplus >= 201103) +# if __has_include() +# define ASIO_HAS_STD_CHRONO 1 +# endif // __has_include() +# endif // (__cplusplus >= 201103) +# endif // defined(__clang__) +# if defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define ASIO_HAS_STD_CHRONO 1 +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ == 6)) +# define ASIO_HAS_STD_CHRONO_MONOTONIC_CLOCK 1 +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ == 6)) +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4) +# endif // defined(__GNUC__) +# if defined(ASIO_MSVC) +# if (_MSC_VER >= 1700) +# define ASIO_HAS_STD_CHRONO 1 +# endif // (_MSC_VER >= 1700) +# endif // defined(ASIO_MSVC) +# endif // !defined(ASIO_DISABLE_STD_CHRONO) +#endif // !defined(ASIO_HAS_STD_CHRONO) + +// Boost support for chrono. +#if !defined(ASIO_HAS_BOOST_CHRONO) +# if !defined(ASIO_DISABLE_BOOST_CHRONO) +# if (BOOST_VERSION >= 104700) +# define ASIO_HAS_BOOST_CHRONO 1 +# endif // (BOOST_VERSION >= 104700) +# endif // !defined(ASIO_DISABLE_BOOST_CHRONO) +#endif // !defined(ASIO_HAS_BOOST_CHRONO) + +// Some form of chrono library is available. +#if !defined(ASIO_HAS_CHRONO) +# if defined(ASIO_HAS_STD_CHRONO) \ + || defined(ASIO_HAS_BOOST_CHRONO) +# define ASIO_HAS_CHRONO 1 +# endif // defined(ASIO_HAS_STD_CHRONO) + // || defined(ASIO_HAS_BOOST_CHRONO) +#endif // !defined(ASIO_HAS_CHRONO) + +// Boost support for the DateTime library. +#if !defined(ASIO_HAS_BOOST_DATE_TIME) +# if !defined(ASIO_DISABLE_BOOST_DATE_TIME) +# define ASIO_HAS_BOOST_DATE_TIME 1 +# endif // !defined(ASIO_DISABLE_BOOST_DATE_TIME) +#endif // !defined(ASIO_HAS_BOOST_DATE_TIME) + +// Standard library support for addressof. +#if !defined(ASIO_HAS_STD_ADDRESSOF) +# if !defined(ASIO_DISABLE_STD_ADDRESSOF) +# if defined(__clang__) +# if defined(ASIO_HAS_CLANG_LIBCXX) +# define ASIO_HAS_STD_ADDRESSOF 1 +# elif (__cplusplus >= 201103) +# define ASIO_HAS_STD_ADDRESSOF 1 +# endif // (__cplusplus >= 201103) +# endif // defined(__clang__) +# if defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define ASIO_HAS_STD_ADDRESSOF 1 +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4) +# endif // defined(__GNUC__) +# if defined(ASIO_MSVC) +# if (_MSC_VER >= 1700) +# define ASIO_HAS_STD_ADDRESSOF 1 +# endif // (_MSC_VER >= 1700) +# endif // defined(ASIO_MSVC) +# endif // !defined(ASIO_DISABLE_STD_ADDRESSOF) +#endif // !defined(ASIO_HAS_STD_ADDRESSOF) + +// Standard library support for the function class. +#if !defined(ASIO_HAS_STD_FUNCTION) +# if !defined(ASIO_DISABLE_STD_FUNCTION) +# if defined(__clang__) +# if defined(ASIO_HAS_CLANG_LIBCXX) +# define ASIO_HAS_STD_FUNCTION 1 +# elif (__cplusplus >= 201103) +# define ASIO_HAS_STD_FUNCTION 1 +# endif // (__cplusplus >= 201103) +# endif // defined(__clang__) +# if defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define ASIO_HAS_STD_FUNCTION 1 +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4) +# endif // defined(__GNUC__) +# if defined(ASIO_MSVC) +# if (_MSC_VER >= 1700) +# define ASIO_HAS_STD_FUNCTION 1 +# endif // (_MSC_VER >= 1700) +# endif // defined(ASIO_MSVC) +# endif // !defined(ASIO_DISABLE_STD_FUNCTION) +#endif // !defined(ASIO_HAS_STD_FUNCTION) + +// Standard library support for type traits. +#if !defined(ASIO_HAS_STD_TYPE_TRAITS) +# if !defined(ASIO_DISABLE_STD_TYPE_TRAITS) +# if defined(__clang__) +# if defined(ASIO_HAS_CLANG_LIBCXX) +# define ASIO_HAS_STD_TYPE_TRAITS 1 +# elif (__cplusplus >= 201103) +# if __has_include() +# define ASIO_HAS_STD_TYPE_TRAITS 1 +# endif // __has_include() +# endif // (__cplusplus >= 201103) +# endif // defined(__clang__) +# if defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define ASIO_HAS_STD_TYPE_TRAITS 1 +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4) +# endif // defined(__GNUC__) +# if defined(ASIO_MSVC) +# if (_MSC_VER >= 1700) +# define ASIO_HAS_STD_TYPE_TRAITS 1 +# endif // (_MSC_VER >= 1700) +# endif // defined(ASIO_MSVC) +# endif // !defined(ASIO_DISABLE_STD_TYPE_TRAITS) +#endif // !defined(ASIO_HAS_STD_TYPE_TRAITS) + +// Standard library support for the nullptr_t type. +#if !defined(ASIO_HAS_NULLPTR) +# if !defined(ASIO_DISABLE_NULLPTR) +# if defined(__clang__) +# if __has_feature(__cxx_nullptr__) +# define ASIO_HAS_NULLPTR 1 +# endif // __has_feature(__cxx_rvalue_references__) +# elif defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define ASIO_HAS_NULLPTR 1 +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4) +# endif // defined(__GNUC__) +# if defined(ASIO_MSVC) +# if (_MSC_VER >= 1700) +# define ASIO_HAS_NULLPTR 1 +# endif // (_MSC_VER >= 1700) +# endif // defined(ASIO_MSVC) +# endif // !defined(ASIO_DISABLE_NULLPTR) +#endif // !defined(ASIO_HAS_NULLPTR) + +// Standard library support for the C++11 allocator additions. +#if !defined(ASIO_HAS_CXX11_ALLOCATORS) +# if !defined(ASIO_DISABLE_CXX11_ALLOCATORS) +# if defined(__clang__) +# if defined(ASIO_HAS_CLANG_LIBCXX) +# define ASIO_HAS_CXX11_ALLOCATORS 1 +# elif (__cplusplus >= 201103) +# define ASIO_HAS_CXX11_ALLOCATORS 1 +# endif // (__cplusplus >= 201103) +# elif defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define ASIO_HAS_CXX11_ALLOCATORS 1 +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4) +# endif // defined(__GNUC__) +# if defined(ASIO_MSVC) +# if (_MSC_VER >= 1800) +# define ASIO_HAS_CXX11_ALLOCATORS 1 +# endif // (_MSC_VER >= 1800) +# endif // defined(ASIO_MSVC) +# endif // !defined(ASIO_DISABLE_CXX11_ALLOCATORS) +#endif // !defined(ASIO_HAS_CXX11_ALLOCATORS) + +// Standard library support for the cstdint header. +#if !defined(ASIO_HAS_CSTDINT) +# if !defined(ASIO_DISABLE_CSTDINT) +# if defined(__clang__) +# if defined(ASIO_HAS_CLANG_LIBCXX) +# define ASIO_HAS_CSTDINT 1 +# elif (__cplusplus >= 201103) +# define ASIO_HAS_CSTDINT 1 +# endif // (__cplusplus >= 201103) +# endif // defined(__clang__) +# if defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define ASIO_HAS_CSTDINT 1 +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4) +# endif // defined(__GNUC__) +# if defined(ASIO_MSVC) +# if (_MSC_VER >= 1700) +# define ASIO_HAS_CSTDINT 1 +# endif // (_MSC_VER >= 1700) +# endif // defined(ASIO_MSVC) +# endif // !defined(ASIO_DISABLE_CSTDINT) +#endif // !defined(ASIO_HAS_CSTDINT) + +// Standard library support for the thread class. +#if !defined(ASIO_HAS_STD_THREAD) +# if !defined(ASIO_DISABLE_STD_THREAD) +# if defined(__clang__) +# if defined(ASIO_HAS_CLANG_LIBCXX) +# define ASIO_HAS_STD_THREAD 1 +# elif (__cplusplus >= 201103) +# if __has_include() +# define ASIO_HAS_STD_THREAD 1 +# endif // __has_include() +# endif // (__cplusplus >= 201103) +# endif // defined(__clang__) +# if defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define ASIO_HAS_STD_THREAD 1 +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4) +# endif // defined(__GNUC__) +# if defined(ASIO_MSVC) +# if (_MSC_VER >= 1700) +# define ASIO_HAS_STD_THREAD 1 +# endif // (_MSC_VER >= 1700) +# endif // defined(ASIO_MSVC) +# endif // !defined(ASIO_DISABLE_STD_THREAD) +#endif // !defined(ASIO_HAS_STD_THREAD) + +// Standard library support for the mutex and condition variable classes. +#if !defined(ASIO_HAS_STD_MUTEX_AND_CONDVAR) +# if !defined(ASIO_DISABLE_STD_MUTEX_AND_CONDVAR) +# if defined(__clang__) +# if defined(ASIO_HAS_CLANG_LIBCXX) +# define ASIO_HAS_STD_MUTEX_AND_CONDVAR 1 +# elif (__cplusplus >= 201103) +# if __has_include() +# define ASIO_HAS_STD_MUTEX_AND_CONDVAR 1 +# endif // __has_include() +# endif // (__cplusplus >= 201103) +# endif // defined(__clang__) +# if defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define ASIO_HAS_STD_MUTEX_AND_CONDVAR 1 +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4) +# endif // defined(__GNUC__) +# if defined(ASIO_MSVC) +# if (_MSC_VER >= 1700) +# define ASIO_HAS_STD_MUTEX_AND_CONDVAR 1 +# endif // (_MSC_VER >= 1700) +# endif // defined(ASIO_MSVC) +# endif // !defined(ASIO_DISABLE_STD_MUTEX_AND_CONDVAR) +#endif // !defined(ASIO_HAS_STD_MUTEX_AND_CONDVAR) + +// Standard library support for the call_once function. +#if !defined(ASIO_HAS_STD_CALL_ONCE) +# if !defined(ASIO_DISABLE_STD_CALL_ONCE) +# if defined(__clang__) +# if defined(ASIO_HAS_CLANG_LIBCXX) +# define ASIO_HAS_STD_CALL_ONCE 1 +# elif (__cplusplus >= 201103) +# if __has_include() +# define ASIO_HAS_STD_CALL_ONCE 1 +# endif // __has_include() +# endif // (__cplusplus >= 201103) +# endif // defined(__clang__) +# if defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define ASIO_HAS_STD_CALL_ONCE 1 +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4) +# endif // defined(__GNUC__) +# if defined(ASIO_MSVC) +# if (_MSC_VER >= 1700) +# define ASIO_HAS_STD_CALL_ONCE 1 +# endif // (_MSC_VER >= 1700) +# endif // defined(ASIO_MSVC) +# endif // !defined(ASIO_DISABLE_STD_CALL_ONCE) +#endif // !defined(ASIO_HAS_STD_CALL_ONCE) + +// Standard library support for futures. +#if !defined(ASIO_HAS_STD_FUTURE) +# if !defined(ASIO_DISABLE_STD_FUTURE) +# if defined(__clang__) +# if defined(ASIO_HAS_CLANG_LIBCXX) +# define ASIO_HAS_STD_FUTURE 1 +# elif (__cplusplus >= 201103) +# if __has_include() +# define ASIO_HAS_STD_FUTURE 1 +# endif // __has_include() +# endif // (__cplusplus >= 201103) +# endif // defined(__clang__) +# if defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# if defined(_GLIBCXX_HAS_GTHREADS) +# define ASIO_HAS_STD_FUTURE 1 +# endif // defined(_GLIBCXX_HAS_GTHREADS) +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4) +# endif // defined(__GNUC__) +# if defined(ASIO_MSVC) +# if (_MSC_VER >= 1700) +# define ASIO_HAS_STD_FUTURE 1 +# endif // (_MSC_VER >= 1700) +# endif // defined(ASIO_MSVC) +# endif // !defined(ASIO_DISABLE_STD_FUTURE) +#endif // !defined(ASIO_HAS_STD_FUTURE) + +// Standard library support for std::string_view. +#if !defined(ASIO_HAS_STD_STRING_VIEW) +# if !defined(ASIO_DISABLE_STD_STRING_VIEW) +# if defined(__clang__) +# if (__cplusplus >= 201703) +# if __has_include() +# define ASIO_HAS_STD_STRING_VIEW 1 +# endif // __has_include() +# endif // (__cplusplus >= 201703) +# endif // defined(__clang__) +# if defined(__GNUC__) +# if (__GNUC__ >= 7) +# if (__cplusplus >= 201703) +# define ASIO_HAS_STD_STRING_VIEW 1 +# endif // (__cplusplus >= 201703) +# endif // (__GNUC__ >= 7) +# endif // defined(__GNUC__) +# if defined(ASIO_MSVC) +# if (_MSC_VER >= 1910 && _HAS_CXX17) +# define ASIO_HAS_STD_STRING_VIEW +# endif // (_MSC_VER >= 1910 && _HAS_CXX17) +# endif // defined(ASIO_MSVC) +# endif // !defined(ASIO_DISABLE_STD_STRING_VIEW) +#endif // !defined(ASIO_HAS_STD_STRING_VIEW) + +// Standard library support for std::experimental::string_view. +#if !defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW) +# if !defined(ASIO_DISABLE_STD_EXPERIMENTAL_STRING_VIEW) +# if defined(__clang__) +# if (__cplusplus >= 201402) +# if __has_include() +# define ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW 1 +# endif // __has_include() +# endif // (__cplusplus >= 201402) +# endif // defined(__clang__) +# if defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) || (__GNUC__ > 4) +# if (__cplusplus >= 201402) +# define ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW 1 +# endif // (__cplusplus >= 201402) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) || (__GNUC__ > 4) +# endif // defined(__GNUC__) +# endif // !defined(ASIO_DISABLE_STD_EXPERIMENTAL_STRING_VIEW) +#endif // !defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW) + +// Standard library has a string_view that we can use. +#if !defined(ASIO_HAS_STRING_VIEW) +# if !defined(ASIO_DISABLE_STRING_VIEW) +# if defined(ASIO_HAS_STD_STRING_VIEW) +# define ASIO_HAS_STRING_VIEW 1 +# elif defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW) +# define ASIO_HAS_STRING_VIEW 1 +# endif // defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW) +# endif // !defined(ASIO_DISABLE_STRING_VIEW) +#endif // !defined(ASIO_HAS_STRING_VIEW) + +// Standard library support for iostream move construction and assignment. +#if !defined(ASIO_HAS_STD_IOSTREAM_MOVE) +# if !defined(ASIO_DISABLE_STD_IOSTREAM_MOVE) +# if defined(__GNUC__) +# if (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define ASIO_HAS_STD_IOSTREAM_MOVE 1 +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // (__GNUC__ > 4) +# endif // defined(__GNUC__) +# if defined(ASIO_MSVC) +# if (_MSC_VER >= 1700) +# define ASIO_HAS_STD_IOSTREAM_MOVE 1 +# endif // (_MSC_VER >= 1700) +# endif // defined(ASIO_MSVC) +# endif // !defined(ASIO_DISABLE_STD_IOSTREAM_MOVE) +#endif // !defined(ASIO_HAS_STD_IOSTREAM_MOVE) + +// Standard library has invoke_result (which supersedes result_of). +#if !defined(ASIO_HAS_STD_INVOKE_RESULT) +# if !defined(ASIO_DISABLE_STD_INVOKE_RESULT) +# if defined(ASIO_MSVC) +# if (_MSC_VER >= 1910 && _HAS_CXX17) +# define ASIO_HAS_STD_INVOKE_RESULT 1 +# endif // (_MSC_VER >= 1910 && _HAS_CXX17) +# endif // defined(ASIO_MSVC) +# endif // !defined(ASIO_DISABLE_STD_INVOKE_RESULT) +#endif // !defined(ASIO_HAS_STD_INVOKE_RESULT) + +// Windows App target. Windows but with a limited API. +#if !defined(ASIO_WINDOWS_APP) +# if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0603) +# include +# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) \ + && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) +# define ASIO_WINDOWS_APP 1 +# endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) + // && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) +# endif // defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0603) +#endif // !defined(ASIO_WINDOWS_APP) + +// Legacy WinRT target. Windows App is preferred. +#if !defined(ASIO_WINDOWS_RUNTIME) +# if !defined(ASIO_WINDOWS_APP) +# if defined(__cplusplus_winrt) +# include +# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) \ + && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) +# define ASIO_WINDOWS_RUNTIME 1 +# endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) + // && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) +# endif // defined(__cplusplus_winrt) +# endif // !defined(ASIO_WINDOWS_APP) +#endif // !defined(ASIO_WINDOWS_RUNTIME) + +// Windows target. Excludes WinRT but includes Windows App targets. +#if !defined(ASIO_WINDOWS) +# if !defined(ASIO_WINDOWS_RUNTIME) +# if defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_WINDOWS) +# define ASIO_WINDOWS 1 +# elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) +# define ASIO_WINDOWS 1 +# elif defined(ASIO_WINDOWS_APP) +# define ASIO_WINDOWS 1 +# endif // defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_WINDOWS) +# endif // !defined(ASIO_WINDOWS_RUNTIME) +#endif // !defined(ASIO_WINDOWS) + +// Windows: target OS version. +#if defined(ASIO_WINDOWS) || defined(__CYGWIN__) +# if !defined(_WIN32_WINNT) && !defined(_WIN32_WINDOWS) +# if defined(_MSC_VER) || defined(__BORLANDC__) +# pragma message( \ + "Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. For example:\n"\ + "- add -D_WIN32_WINNT=0x0501 to the compiler command line; or\n"\ + "- add _WIN32_WINNT=0x0501 to your project's Preprocessor Definitions.\n"\ + "Assuming _WIN32_WINNT=0x0501 (i.e. Windows XP target).") +# else // defined(_MSC_VER) || defined(__BORLANDC__) +# warning Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. +# warning For example, add -D_WIN32_WINNT=0x0501 to the compiler command line. +# warning Assuming _WIN32_WINNT=0x0501 (i.e. Windows XP target). +# endif // defined(_MSC_VER) || defined(__BORLANDC__) +# define _WIN32_WINNT 0x0501 +# endif // !defined(_WIN32_WINNT) && !defined(_WIN32_WINDOWS) +# if defined(_MSC_VER) +# if defined(_WIN32) && !defined(WIN32) +# if !defined(_WINSOCK2API_) +# define WIN32 // Needed for correct types in winsock2.h +# else // !defined(_WINSOCK2API_) +# error Please define the macro WIN32 in your compiler options +# endif // !defined(_WINSOCK2API_) +# endif // defined(_WIN32) && !defined(WIN32) +# endif // defined(_MSC_VER) +# if defined(__BORLANDC__) +# if defined(__WIN32__) && !defined(WIN32) +# if !defined(_WINSOCK2API_) +# define WIN32 // Needed for correct types in winsock2.h +# else // !defined(_WINSOCK2API_) +# error Please define the macro WIN32 in your compiler options +# endif // !defined(_WINSOCK2API_) +# endif // defined(__WIN32__) && !defined(WIN32) +# endif // defined(__BORLANDC__) +# if defined(__CYGWIN__) +# if !defined(__USE_W32_SOCKETS) +# error You must add -D__USE_W32_SOCKETS to your compiler options. +# endif // !defined(__USE_W32_SOCKETS) +# endif // defined(__CYGWIN__) +#endif // defined(ASIO_WINDOWS) || defined(__CYGWIN__) + +// Windows: minimise header inclusion. +#if defined(ASIO_WINDOWS) || defined(__CYGWIN__) +# if !defined(ASIO_NO_WIN32_LEAN_AND_MEAN) +# if !defined(WIN32_LEAN_AND_MEAN) +# define WIN32_LEAN_AND_MEAN +# endif // !defined(WIN32_LEAN_AND_MEAN) +# endif // !defined(ASIO_NO_WIN32_LEAN_AND_MEAN) +#endif // defined(ASIO_WINDOWS) || defined(__CYGWIN__) + +// Windows: suppress definition of "min" and "max" macros. +#if defined(ASIO_WINDOWS) || defined(__CYGWIN__) +# if !defined(ASIO_NO_NOMINMAX) +# if !defined(NOMINMAX) +# define NOMINMAX 1 +# endif // !defined(NOMINMAX) +# endif // !defined(ASIO_NO_NOMINMAX) +#endif // defined(ASIO_WINDOWS) || defined(__CYGWIN__) + +// Windows: IO Completion Ports. +#if !defined(ASIO_HAS_IOCP) +# if defined(ASIO_WINDOWS) || defined(__CYGWIN__) +# if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0400) +# if !defined(UNDER_CE) && !defined(ASIO_WINDOWS_APP) +# if !defined(ASIO_DISABLE_IOCP) +# define ASIO_HAS_IOCP 1 +# endif // !defined(ASIO_DISABLE_IOCP) +# endif // !defined(UNDER_CE) && !defined(ASIO_WINDOWS_APP) +# endif // defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0400) +# endif // defined(ASIO_WINDOWS) || defined(__CYGWIN__) +#endif // !defined(ASIO_HAS_IOCP) + +// On POSIX (and POSIX-like) platforms we need to include unistd.h in order to +// get access to the various platform feature macros, e.g. to be able to test +// for threads support. +#if !defined(ASIO_HAS_UNISTD_H) +# if !defined(ASIO_HAS_BOOST_CONFIG) +# if defined(unix) \ + || defined(__unix) \ + || defined(_XOPEN_SOURCE) \ + || defined(_POSIX_SOURCE) \ + || (defined(__MACH__) && defined(__APPLE__)) \ + || defined(__FreeBSD__) \ + || defined(__NetBSD__) \ + || defined(__OpenBSD__) \ + || defined(__linux__) +# define ASIO_HAS_UNISTD_H 1 +# endif +# endif // !defined(ASIO_HAS_BOOST_CONFIG) +#endif // !defined(ASIO_HAS_UNISTD_H) +#if defined(ASIO_HAS_UNISTD_H) +# include +#endif // defined(ASIO_HAS_UNISTD_H) + +// Linux: epoll, eventfd and timerfd. +#if defined(__linux__) +# include +# if !defined(ASIO_HAS_EPOLL) +# if !defined(ASIO_DISABLE_EPOLL) +# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,45) +# define ASIO_HAS_EPOLL 1 +# endif // LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,45) +# endif // !defined(ASIO_DISABLE_EPOLL) +# endif // !defined(ASIO_HAS_EPOLL) +# if !defined(ASIO_HAS_EVENTFD) +# if !defined(ASIO_DISABLE_EVENTFD) +# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) +# define ASIO_HAS_EVENTFD 1 +# endif // LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) +# endif // !defined(ASIO_DISABLE_EVENTFD) +# endif // !defined(ASIO_HAS_EVENTFD) +# if !defined(ASIO_HAS_TIMERFD) +# if defined(ASIO_HAS_EPOLL) +# if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 8) +# define ASIO_HAS_TIMERFD 1 +# endif // (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 8) +# endif // defined(ASIO_HAS_EPOLL) +# endif // !defined(ASIO_HAS_TIMERFD) +#endif // defined(__linux__) + +// Mac OS X, FreeBSD, NetBSD, OpenBSD: kqueue. +#if (defined(__MACH__) && defined(__APPLE__)) \ + || defined(__FreeBSD__) \ + || defined(__NetBSD__) \ + || defined(__OpenBSD__) +# if !defined(ASIO_HAS_KQUEUE) +# if !defined(ASIO_DISABLE_KQUEUE) +# define ASIO_HAS_KQUEUE 1 +# endif // !defined(ASIO_DISABLE_KQUEUE) +# endif // !defined(ASIO_HAS_KQUEUE) +#endif // (defined(__MACH__) && defined(__APPLE__)) + // || defined(__FreeBSD__) + // || defined(__NetBSD__) + // || defined(__OpenBSD__) + +// Solaris: /dev/poll. +#if defined(__sun) +# if !defined(ASIO_HAS_DEV_POLL) +# if !defined(ASIO_DISABLE_DEV_POLL) +# define ASIO_HAS_DEV_POLL 1 +# endif // !defined(ASIO_DISABLE_DEV_POLL) +# endif // !defined(ASIO_HAS_DEV_POLL) +#endif // defined(__sun) + +// Serial ports. +#if !defined(ASIO_HAS_SERIAL_PORT) +# if defined(ASIO_HAS_IOCP) \ + || !defined(ASIO_WINDOWS) \ + && !defined(ASIO_WINDOWS_RUNTIME) \ + && !defined(__CYGWIN__) +# if !defined(__SYMBIAN32__) +# if !defined(ASIO_DISABLE_SERIAL_PORT) +# define ASIO_HAS_SERIAL_PORT 1 +# endif // !defined(ASIO_DISABLE_SERIAL_PORT) +# endif // !defined(__SYMBIAN32__) +# endif // defined(ASIO_HAS_IOCP) + // || !defined(ASIO_WINDOWS) + // && !defined(ASIO_WINDOWS_RUNTIME) + // && !defined(__CYGWIN__) +#endif // !defined(ASIO_HAS_SERIAL_PORT) + +// Windows: stream handles. +#if !defined(ASIO_HAS_WINDOWS_STREAM_HANDLE) +# if !defined(ASIO_DISABLE_WINDOWS_STREAM_HANDLE) +# if defined(ASIO_HAS_IOCP) +# define ASIO_HAS_WINDOWS_STREAM_HANDLE 1 +# endif // defined(ASIO_HAS_IOCP) +# endif // !defined(ASIO_DISABLE_WINDOWS_STREAM_HANDLE) +#endif // !defined(ASIO_HAS_WINDOWS_STREAM_HANDLE) + +// Windows: random access handles. +#if !defined(ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE) +# if !defined(ASIO_DISABLE_WINDOWS_RANDOM_ACCESS_HANDLE) +# if defined(ASIO_HAS_IOCP) +# define ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE 1 +# endif // defined(ASIO_HAS_IOCP) +# endif // !defined(ASIO_DISABLE_WINDOWS_RANDOM_ACCESS_HANDLE) +#endif // !defined(ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE) + +// Windows: object handles. +#if !defined(ASIO_HAS_WINDOWS_OBJECT_HANDLE) +# if !defined(ASIO_DISABLE_WINDOWS_OBJECT_HANDLE) +# if defined(ASIO_WINDOWS) || defined(__CYGWIN__) +# if !defined(UNDER_CE) && !defined(ASIO_WINDOWS_APP) +# define ASIO_HAS_WINDOWS_OBJECT_HANDLE 1 +# endif // !defined(UNDER_CE) && !defined(ASIO_WINDOWS_APP) +# endif // defined(ASIO_WINDOWS) || defined(__CYGWIN__) +# endif // !defined(ASIO_DISABLE_WINDOWS_OBJECT_HANDLE) +#endif // !defined(ASIO_HAS_WINDOWS_OBJECT_HANDLE) + +// Windows: OVERLAPPED wrapper. +#if !defined(ASIO_HAS_WINDOWS_OVERLAPPED_PTR) +# if !defined(ASIO_DISABLE_WINDOWS_OVERLAPPED_PTR) +# if defined(ASIO_HAS_IOCP) +# define ASIO_HAS_WINDOWS_OVERLAPPED_PTR 1 +# endif // defined(ASIO_HAS_IOCP) +# endif // !defined(ASIO_DISABLE_WINDOWS_OVERLAPPED_PTR) +#endif // !defined(ASIO_HAS_WINDOWS_OVERLAPPED_PTR) + +// POSIX: stream-oriented file descriptors. +#if !defined(ASIO_HAS_POSIX_STREAM_DESCRIPTOR) +# if !defined(ASIO_DISABLE_POSIX_STREAM_DESCRIPTOR) +# if !defined(ASIO_WINDOWS) \ + && !defined(ASIO_WINDOWS_RUNTIME) \ + && !defined(__CYGWIN__) +# define ASIO_HAS_POSIX_STREAM_DESCRIPTOR 1 +# endif // !defined(ASIO_WINDOWS) + // && !defined(ASIO_WINDOWS_RUNTIME) + // && !defined(__CYGWIN__) +# endif // !defined(ASIO_DISABLE_POSIX_STREAM_DESCRIPTOR) +#endif // !defined(ASIO_HAS_POSIX_STREAM_DESCRIPTOR) + +// UNIX domain sockets. +#if !defined(ASIO_HAS_LOCAL_SOCKETS) +# if !defined(ASIO_DISABLE_LOCAL_SOCKETS) +# if !defined(ASIO_WINDOWS) \ + && !defined(ASIO_WINDOWS_RUNTIME) \ + && !defined(__CYGWIN__) +# define ASIO_HAS_LOCAL_SOCKETS 1 +# endif // !defined(ASIO_WINDOWS) + // && !defined(ASIO_WINDOWS_RUNTIME) + // && !defined(__CYGWIN__) +# endif // !defined(ASIO_DISABLE_LOCAL_SOCKETS) +#endif // !defined(ASIO_HAS_LOCAL_SOCKETS) + +// Can use sigaction() instead of signal(). +#if !defined(ASIO_HAS_SIGACTION) +# if !defined(ASIO_DISABLE_SIGACTION) +# if !defined(ASIO_WINDOWS) \ + && !defined(ASIO_WINDOWS_RUNTIME) \ + && !defined(__CYGWIN__) +# define ASIO_HAS_SIGACTION 1 +# endif // !defined(ASIO_WINDOWS) + // && !defined(ASIO_WINDOWS_RUNTIME) + // && !defined(__CYGWIN__) +# endif // !defined(ASIO_DISABLE_SIGACTION) +#endif // !defined(ASIO_HAS_SIGACTION) + +// Can use signal(). +#if !defined(ASIO_HAS_SIGNAL) +# if !defined(ASIO_DISABLE_SIGNAL) +# if !defined(UNDER_CE) +# define ASIO_HAS_SIGNAL 1 +# endif // !defined(UNDER_CE) +# endif // !defined(ASIO_DISABLE_SIGNAL) +#endif // !defined(ASIO_HAS_SIGNAL) + +// Can use getaddrinfo() and getnameinfo(). +#if !defined(ASIO_HAS_GETADDRINFO) +# if !defined(ASIO_DISABLE_GETADDRINFO) +# if defined(ASIO_WINDOWS) || defined(__CYGWIN__) +# if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0501) +# define ASIO_HAS_GETADDRINFO 1 +# elif defined(UNDER_CE) +# define ASIO_HAS_GETADDRINFO 1 +# endif // defined(UNDER_CE) +# elif defined(__MACH__) && defined(__APPLE__) +# if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) +# if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) +# define ASIO_HAS_GETADDRINFO 1 +# endif // (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) +# else // defined(__MAC_OS_X_VERSION_MIN_REQUIRED) +# define ASIO_HAS_GETADDRINFO 1 +# endif // defined(__MAC_OS_X_VERSION_MIN_REQUIRED) +# else // defined(__MACH__) && defined(__APPLE__) +# define ASIO_HAS_GETADDRINFO 1 +# endif // defined(__MACH__) && defined(__APPLE__) +# endif // !defined(ASIO_DISABLE_GETADDRINFO) +#endif // !defined(ASIO_HAS_GETADDRINFO) + +// Whether standard iostreams are disabled. +#if !defined(ASIO_NO_IOSTREAM) +# if defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_NO_IOSTREAM) +# define ASIO_NO_IOSTREAM 1 +# endif // !defined(BOOST_NO_IOSTREAM) +#endif // !defined(ASIO_NO_IOSTREAM) + +// Whether exception handling is disabled. +#if !defined(ASIO_NO_EXCEPTIONS) +# if defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_NO_EXCEPTIONS) +# define ASIO_NO_EXCEPTIONS 1 +# endif // !defined(BOOST_NO_EXCEPTIONS) +#endif // !defined(ASIO_NO_EXCEPTIONS) + +// Whether the typeid operator is supported. +#if !defined(ASIO_NO_TYPEID) +# if defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_NO_TYPEID) +# define ASIO_NO_TYPEID 1 +# endif // !defined(BOOST_NO_TYPEID) +#endif // !defined(ASIO_NO_TYPEID) + +// Threads. +#if !defined(ASIO_HAS_THREADS) +# if !defined(ASIO_DISABLE_THREADS) +# if defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_HAS_THREADS) +# define ASIO_HAS_THREADS 1 +# elif defined(__GNUC__) && !defined(__MINGW32__) \ + && !defined(linux) && !defined(__linux) && !defined(__linux__) +# define ASIO_HAS_THREADS 1 +# elif defined(_MT) || defined(__MT__) +# define ASIO_HAS_THREADS 1 +# elif defined(_REENTRANT) +# define ASIO_HAS_THREADS 1 +# elif defined(__APPLE__) +# define ASIO_HAS_THREADS 1 +# elif defined(_POSIX_THREADS) && (_POSIX_THREADS + 0 >= 0) +# define ASIO_HAS_THREADS 1 +# elif defined(_PTHREADS) +# define ASIO_HAS_THREADS 1 +# endif // defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_HAS_THREADS) +# endif // !defined(ASIO_DISABLE_THREADS) +#endif // !defined(ASIO_HAS_THREADS) + +// POSIX threads. +#if !defined(ASIO_HAS_PTHREADS) +# if defined(ASIO_HAS_THREADS) +# if defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_HAS_PTHREADS) +# define ASIO_HAS_PTHREADS 1 +# elif defined(_POSIX_THREADS) && (_POSIX_THREADS + 0 >= 0) +# define ASIO_HAS_PTHREADS 1 +# endif // defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_HAS_PTHREADS) +# endif // defined(ASIO_HAS_THREADS) +#endif // !defined(ASIO_HAS_PTHREADS) + +// Helper to prevent macro expansion. +#define ASIO_PREVENT_MACRO_SUBSTITUTION + +// Helper to define in-class constants. +#if !defined(ASIO_STATIC_CONSTANT) +# if !defined(ASIO_DISABLE_BOOST_STATIC_CONSTANT) +# define ASIO_STATIC_CONSTANT(type, assignment) \ + BOOST_STATIC_CONSTANT(type, assignment) +# else // !defined(ASIO_DISABLE_BOOST_STATIC_CONSTANT) +# define ASIO_STATIC_CONSTANT(type, assignment) \ + static const type assignment +# endif // !defined(ASIO_DISABLE_BOOST_STATIC_CONSTANT) +#endif // !defined(ASIO_STATIC_CONSTANT) + +// Boost array library. +#if !defined(ASIO_HAS_BOOST_ARRAY) +# if !defined(ASIO_DISABLE_BOOST_ARRAY) +# define ASIO_HAS_BOOST_ARRAY 1 +# endif // !defined(ASIO_DISABLE_BOOST_ARRAY) +#endif // !defined(ASIO_HAS_BOOST_ARRAY) + +// Boost assert macro. +#if !defined(ASIO_HAS_BOOST_ASSERT) +# if !defined(ASIO_DISABLE_BOOST_ASSERT) +# define ASIO_HAS_BOOST_ASSERT 1 +# endif // !defined(ASIO_DISABLE_BOOST_ASSERT) +#endif // !defined(ASIO_HAS_BOOST_ASSERT) + +// Boost limits header. +#if !defined(ASIO_HAS_BOOST_LIMITS) +# if !defined(ASIO_DISABLE_BOOST_LIMITS) +# define ASIO_HAS_BOOST_LIMITS 1 +# endif // !defined(ASIO_DISABLE_BOOST_LIMITS) +#endif // !defined(ASIO_HAS_BOOST_LIMITS) + +// Boost throw_exception function. +#if !defined(ASIO_HAS_BOOST_THROW_EXCEPTION) +# if !defined(ASIO_DISABLE_BOOST_THROW_EXCEPTION) +# define ASIO_HAS_BOOST_THROW_EXCEPTION 1 +# endif // !defined(ASIO_DISABLE_BOOST_THROW_EXCEPTION) +#endif // !defined(ASIO_HAS_BOOST_THROW_EXCEPTION) + +// Boost regex library. +#if !defined(ASIO_HAS_BOOST_REGEX) +# if !defined(ASIO_DISABLE_BOOST_REGEX) +# define ASIO_HAS_BOOST_REGEX 1 +# endif // !defined(ASIO_DISABLE_BOOST_REGEX) +#endif // !defined(ASIO_HAS_BOOST_REGEX) + +// Boost bind function. +#if !defined(ASIO_HAS_BOOST_BIND) +# if !defined(ASIO_DISABLE_BOOST_BIND) +# define ASIO_HAS_BOOST_BIND 1 +# endif // !defined(ASIO_DISABLE_BOOST_BIND) +#endif // !defined(ASIO_HAS_BOOST_BIND) + +// Boost's BOOST_WORKAROUND macro. +#if !defined(ASIO_HAS_BOOST_WORKAROUND) +# if !defined(ASIO_DISABLE_BOOST_WORKAROUND) +# define ASIO_HAS_BOOST_WORKAROUND 1 +# endif // !defined(ASIO_DISABLE_BOOST_WORKAROUND) +#endif // !defined(ASIO_HAS_BOOST_WORKAROUND) + +// Microsoft Visual C++'s secure C runtime library. +#if !defined(ASIO_HAS_SECURE_RTL) +# if !defined(ASIO_DISABLE_SECURE_RTL) +# if defined(ASIO_MSVC) \ + && (ASIO_MSVC >= 1400) \ + && !defined(UNDER_CE) +# define ASIO_HAS_SECURE_RTL 1 +# endif // defined(ASIO_MSVC) + // && (ASIO_MSVC >= 1400) + // && !defined(UNDER_CE) +# endif // !defined(ASIO_DISABLE_SECURE_RTL) +#endif // !defined(ASIO_HAS_SECURE_RTL) + +// Handler hooking. Disabled for ancient Borland C++ and gcc compilers. +#if !defined(ASIO_HAS_HANDLER_HOOKS) +# if !defined(ASIO_DISABLE_HANDLER_HOOKS) +# if defined(__GNUC__) +# if (__GNUC__ >= 3) +# define ASIO_HAS_HANDLER_HOOKS 1 +# endif // (__GNUC__ >= 3) +# elif !defined(__BORLANDC__) +# define ASIO_HAS_HANDLER_HOOKS 1 +# endif // !defined(__BORLANDC__) +# endif // !defined(ASIO_DISABLE_HANDLER_HOOKS) +#endif // !defined(ASIO_HAS_HANDLER_HOOKS) + +// Support for the __thread keyword extension. +#if !defined(ASIO_DISABLE_THREAD_KEYWORD_EXTENSION) +# if defined(__linux__) +# if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) +# if ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3) +# if !defined(__INTEL_COMPILER) && !defined(__ICL) \ + && !(defined(__clang__) && defined(__ANDROID__)) +# define ASIO_HAS_THREAD_KEYWORD_EXTENSION 1 +# define ASIO_THREAD_KEYWORD __thread +# elif defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1100) +# define ASIO_HAS_THREAD_KEYWORD_EXTENSION 1 +# endif // defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1100) + // && !(defined(__clang__) && defined(__ANDROID__)) +# endif // ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3) +# endif // defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) +# endif // defined(__linux__) +# if defined(ASIO_MSVC) && defined(ASIO_WINDOWS_RUNTIME) +# if (_MSC_VER >= 1700) +# define ASIO_HAS_THREAD_KEYWORD_EXTENSION 1 +# define ASIO_THREAD_KEYWORD __declspec(thread) +# endif // (_MSC_VER >= 1700) +# endif // defined(ASIO_MSVC) && defined(ASIO_WINDOWS_RUNTIME) +#endif // !defined(ASIO_DISABLE_THREAD_KEYWORD_EXTENSION) +#if !defined(ASIO_THREAD_KEYWORD) +# define ASIO_THREAD_KEYWORD __thread +#endif // !defined(ASIO_THREAD_KEYWORD) + +// Support for POSIX ssize_t typedef. +#if !defined(ASIO_DISABLE_SSIZE_T) +# if defined(__linux__) \ + || (defined(__MACH__) && defined(__APPLE__)) +# define ASIO_HAS_SSIZE_T 1 +# endif // defined(__linux__) + // || (defined(__MACH__) && defined(__APPLE__)) +#endif // !defined(ASIO_DISABLE_SSIZE_T) + +// Helper macros to manage the transition away from the old services-based API. +#if defined(ASIO_ENABLE_OLD_SERVICES) +# define ASIO_SVC_TPARAM , typename Service +# define ASIO_SVC_TPARAM_DEF1(d1) , typename Service d1 +# define ASIO_SVC_TPARAM_DEF2(d1, d2) , typename Service d1, d2 +# define ASIO_SVC_TARG , Service +# define ASIO_SVC_T Service +# define ASIO_SVC_TPARAM1 , typename Service1 +# define ASIO_SVC_TPARAM1_DEF1(d1) , typename Service1 d1 +# define ASIO_SVC_TPARAM1_DEF2(d1, d2) , typename Service1 d1, d2 +# define ASIO_SVC_TARG1 , Service1 +# define ASIO_SVC_T1 Service1 +# define ASIO_SVC_ACCESS public +#else // defined(ASIO_ENABLE_OLD_SERVICES) +# define ASIO_SVC_TPARAM +# define ASIO_SVC_TPARAM_DEF1(d1) +# define ASIO_SVC_TPARAM_DEF2(d1, d2) +# define ASIO_SVC_TARG +// ASIO_SVC_T is defined at each point of use. +# define ASIO_SVC_TPARAM1 +# define ASIO_SVC_TPARAM1_DEF1(d1) +# define ASIO_SVC_TPARAM1_DEF2(d1, d2) +# define ASIO_SVC_TARG1 +// ASIO_SVC_T1 is defined at each point of use. +# define ASIO_SVC_ACCESS protected +#endif // defined(ASIO_ENABLE_OLD_SERVICES) + +// Helper macros to manage transition away from error_code return values. +#if defined(ASIO_NO_DEPRECATED) +# define ASIO_SYNC_OP_VOID void +# define ASIO_SYNC_OP_VOID_RETURN(e) return +#else // defined(ASIO_NO_DEPRECATED) +# define ASIO_SYNC_OP_VOID asio::error_code +# define ASIO_SYNC_OP_VOID_RETURN(e) return e +#endif // defined(ASIO_NO_DEPRECATED) + +// Newer gcc, clang need special treatment to suppress unused typedef warnings. +#if defined(__clang__) +# if defined(__apple_build_version__) +# if (__clang_major__ >= 7) +# define ASIO_UNUSED_TYPEDEF __attribute__((__unused__)) +# endif // (__clang_major__ >= 7) +# elif ((__clang_major__ == 3) && (__clang_minor__ >= 6)) \ + || (__clang_major__ > 3) +# define ASIO_UNUSED_TYPEDEF __attribute__((__unused__)) +# endif // ((__clang_major__ == 3) && (__clang_minor__ >= 6)) + // || (__clang_major__ > 3) +#elif defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ > 4) +# define ASIO_UNUSED_TYPEDEF __attribute__((__unused__)) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ > 4) +#endif // defined(__GNUC__) +#if !defined(ASIO_UNUSED_TYPEDEF) +# define ASIO_UNUSED_TYPEDEF +#endif // !defined(ASIO_UNUSED_TYPEDEF) + +// Some versions of gcc generate spurious warnings about unused variables. +#if defined(__GNUC__) +# if (__GNUC__ >= 4) +# define ASIO_UNUSED_VARIABLE __attribute__((__unused__)) +# endif // (__GNUC__ >= 4) +#endif // defined(__GNUC__) +#if !defined(ASIO_UNUSED_VARIABLE) +# define ASIO_UNUSED_VARIABLE +#endif // !defined(ASIO_UNUSED_VARIABLE) + +// Support co_await on compilers known to allow it. +#if !defined(ASIO_HAS_CO_AWAIT) +# if !defined(ASIO_DISABLE_CO_AWAIT) +# if defined(ASIO_MSVC) +# if (_MSC_FULL_VER >= 190023506) +# if defined(_RESUMABLE_FUNCTIONS_SUPPORTED) +# define ASIO_HAS_CO_AWAIT 1 +# endif // defined(_RESUMABLE_FUNCTIONS_SUPPORTED) +# endif // (_MSC_FULL_VER >= 190023506) +# endif // defined(ASIO_MSVC) +# endif // !defined(ASIO_DISABLE_CO_AWAIT) +# if defined(__clang__) +# if (__cpp_coroutines >= 201703) +# if __has_include() +# define ASIO_HAS_CO_AWAIT 1 +# endif // __has_include() +# endif // (__cpp_coroutines >= 201703) +# endif // defined(__clang__) +#endif // !defined(ASIO_HAS_CO_AWAIT) + +#endif // ASIO_DETAIL_CONFIG_HPP diff --git a/asio/asio/include/asio/ssl.hpp b/asio/asio/include/asio/ssl.hpp index cbad19d81..ef64f1cf2 100644 --- a/asio/asio/include/asio/ssl.hpp +++ b/asio/asio/include/asio/ssl.hpp @@ -15,6 +15,10 @@ # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) +#if defined(ASIO_USE_WOLFSSL) +#include +#endif + #include "asio/ssl/context.hpp" #include "asio/ssl/context_base.hpp" #include "asio/ssl/error.hpp" diff --git a/asio/asio/include/asio/ssl/context_base.hpp b/asio/asio/include/asio/ssl/context_base.hpp index 73ab182ad..5c35c7f3f 100644 --- a/asio/asio/include/asio/ssl/context_base.hpp +++ b/asio/asio/include/asio/ssl/context_base.hpp @@ -15,7 +15,7 @@ # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) -#if defined(WOLFSSL_ASIO) +#if defined(ASIO_USE_WOLFSSL) #include #endif diff --git a/asio/asio/include/asio/ssl/detail/impl/openssl_init.ipp b/asio/asio/include/asio/ssl/detail/impl/openssl_init.ipp index 085015ab6..2b90005a4 100644 --- a/asio/asio/include/asio/ssl/detail/impl/openssl_init.ipp +++ b/asio/asio/include/asio/ssl/detail/impl/openssl_init.ipp @@ -85,7 +85,7 @@ public: #endif // (OPENSSL_VERSION_NUMBER >= 0x10002000L) // && (OPENSSL_VERSION_NUMBER < 0x10100000L) // && !defined(SSL_OP_NO_COMPRESSION) -#if !defined(OPENSSL_IS_BORINGSSL) && !defined(WOLFSSL_ASIO) +#if !defined(OPENSSL_IS_BORINGSSL) && !defined(ASIO_USE_WOLFSSL) ::CONF_modules_unload(1); #endif // !defined(OPENSSL_IS_BORINGSSL) #if !defined(OPENSSL_NO_ENGINE) \ diff --git a/asio/asio/include/asio/ssl/detail/openssl_init.hpp b/asio/asio/include/asio/ssl/detail/openssl_init.hpp index b1ff23c78..8fea46bb2 100644 --- a/asio/asio/include/asio/ssl/detail/openssl_init.hpp +++ b/asio/asio/include/asio/ssl/detail/openssl_init.hpp @@ -15,7 +15,7 @@ # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) -#if defined(WOLFSSL_ASIO) +#if defined(ASIO_USE_WOLFSSL) #include #endif diff --git a/asio/asio/include/asio/ssl/error.hpp b/asio/asio/include/asio/ssl/error.hpp index 1015268cd..4378ec9f7 100644 --- a/asio/asio/include/asio/ssl/error.hpp +++ b/asio/asio/include/asio/ssl/error.hpp @@ -15,7 +15,7 @@ # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) -#if defined(WOLFSSL_ASIO) +#if defined(ASIO_USE_WOLFSSL) #include #endif @@ -50,7 +50,7 @@ enum stream_errors /// The underlying stream closed before the ssl stream gracefully shut down. stream_truncated #elif (OPENSSL_VERSION_NUMBER < 0x10100000L) && !defined(OPENSSL_IS_BORINGSSL) \ - && !defined(WOLFSSL_ASIO) + && !defined(ASIO_USE_WOLFSSL) stream_truncated = ERR_PACK(ERR_LIB_SSL, 0, SSL_R_SHORT_READ) #else stream_truncated = 1 diff --git a/asio/asio/include/asio/ssl/impl/context.ipp b/asio/asio/include/asio/ssl/impl/context.ipp index 67e3fa57b..b551f063d 100644 --- a/asio/asio/include/asio/ssl/impl/context.ipp +++ b/asio/asio/include/asio/ssl/impl/context.ipp @@ -349,7 +349,7 @@ context::~context() if (handle_) { #if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER) \ - || defined(WOLFSSL_ASIO) + || defined(ASIO_USE_WOLFSSL) void* cb_userdata = ::SSL_CTX_get_default_passwd_cb_userdata(handle_); #else // (OPENSSL_VERSION_NUMBER >= 0x10100000L) void* cb_userdata = handle_->default_passwd_callback_userdata; @@ -361,7 +361,7 @@ context::~context() cb_userdata); delete callback; #if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER) \ - || defined(WOLFSSL_ASIO) + || defined(ASIO_USE_WOLFSSL) ::SSL_CTX_set_default_passwd_cb_userdata(handle_, 0); #else // (OPENSSL_VERSION_NUMBER >= 0x10100000L) handle_->default_passwd_callback_userdata = 0; @@ -699,7 +699,7 @@ ASIO_SYNC_OP_VOID context::use_certificate_chain( if (bio.p) { #if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER) \ - || defined(WOLFSSL_ASIO) + || defined(ASIO_USE_WOLFSSL) pem_password_cb* callback = ::SSL_CTX_get_default_passwd_cb(handle_); void* cb_userdata = ::SSL_CTX_get_default_passwd_cb_userdata(handle_); #else // (OPENSSL_VERSION_NUMBER >= 0x10100000L) @@ -727,7 +727,7 @@ ASIO_SYNC_OP_VOID context::use_certificate_chain( } #if (OPENSSL_VERSION_NUMBER >= 0x10002000L) && !defined(LIBRESSL_VERSION_NUMBER) \ - || defined(WOLFSSL_ASIO) + || defined(ASIO_USE_WOLFSSL) ::SSL_CTX_clear_chain_certs(handle_); #else if (handle_->extra_certs) @@ -805,7 +805,7 @@ ASIO_SYNC_OP_VOID context::use_private_key( ::ERR_clear_error(); #if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER) \ - || defined(WOLFSSL_ASIO) + || defined(ASIO_USE_WOLFSSL) pem_password_cb* callback = ::SSL_CTX_get_default_passwd_cb(handle_); void* cb_userdata = ::SSL_CTX_get_default_passwd_cb_userdata(handle_); #else // (OPENSSL_VERSION_NUMBER >= 0x10100000L) @@ -873,7 +873,7 @@ ASIO_SYNC_OP_VOID context::use_rsa_private_key( ::ERR_clear_error(); #if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER) \ - || defined(WOLFSSL_ASIO) + || defined(ASIO_USE_WOLFSSL) pem_password_cb* callback = ::SSL_CTX_get_default_passwd_cb(handle_); void* cb_userdata = ::SSL_CTX_get_default_passwd_cb_userdata(handle_); #else // (OPENSSL_VERSION_NUMBER >= 0x10100000L) @@ -1113,7 +1113,7 @@ ASIO_SYNC_OP_VOID context::do_set_password_callback( detail::password_callback_base* callback, asio::error_code& ec) { #if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER) \ - || defined(WOLFSSL_ASIO) + || defined(ASIO_USE_WOLFSSL) void* old_callback = ::SSL_CTX_get_default_passwd_cb_userdata(handle_); ::SSL_CTX_set_default_passwd_cb_userdata(handle_, callback); #else // (OPENSSL_VERSION_NUMBER >= 0x10100000L) diff --git a/asio/asio/include/asio/ssl/rfc2818_verification.hpp b/asio/asio/include/asio/ssl/rfc2818_verification.hpp index 136950c9f..955ef2aa6 100644 --- a/asio/asio/include/asio/ssl/rfc2818_verification.hpp +++ b/asio/asio/include/asio/ssl/rfc2818_verification.hpp @@ -15,7 +15,7 @@ # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) -#if defined(WOLFSSL_ASIO) +#if defined(ASIO_USE_WOLFSSL) #include #endif diff --git a/asio/asio/src/tests/unit/ip/address_v4.cpp b/asio/asio/src/tests/unit/ip/address_v4.cpp new file mode 100644 index 000000000..aea67c2c6 --- /dev/null +++ b/asio/asio/src/tests/unit/ip/address_v4.cpp @@ -0,0 +1,324 @@ +// +// address_v4.cpp +// ~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2018 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) +// + +// Disable autolinking for unit tests. +#if !defined(BOOST_ALL_NO_LIB) +#define BOOST_ALL_NO_LIB 1 +#endif // !defined(BOOST_ALL_NO_LIB) + +// Test that header file is self-contained. +#include "asio/ip/address_v4.hpp" + +#include "../unit_test.hpp" +#include + +//------------------------------------------------------------------------------ + +// ip_address_v4_compile test +// ~~~~~~~~~~~~~~~~~~~~~~~~~~ +// The following test checks that all public member functions on the class +// ip::address_v4 compile and link correctly. Runtime failures are ignored. + +namespace ip_address_v4_compile { + +void test() +{ + using namespace asio; + namespace ip = asio::ip; + + try + { + asio::error_code ec; + + // address_v4 constructors. + + ip::address_v4 addr1; + const ip::address_v4::bytes_type const_bytes_value = { { 127, 0, 0, 1 } }; + ip::address_v4 addr2(const_bytes_value); + const unsigned long const_ulong_value = 0x7F000001; + ip::address_v4 addr3(const_ulong_value); + + // address_v4 functions. + + bool b = addr1.is_loopback(); + (void)b; + + b = addr1.is_unspecified(); + (void)b; + +#if !defined(ASIO_NO_DEPRECATED) + b = addr1.is_class_a(); + (void)b; + + b = addr1.is_class_b(); + (void)b; + + b = addr1.is_class_c(); + (void)b; +#endif // !defined(ASIO_NO_DEPRECATED) + + b = addr1.is_multicast(); + (void)b; + + ip::address_v4::bytes_type bytes_value = addr1.to_bytes(); + (void)bytes_value; + + ip::address_v4::uint_type uint_value = addr1.to_uint(); + (void)uint_value; + +#if !defined(ASIO_NO_DEPRECATED) + unsigned long ulong_value = addr1.to_ulong(); + (void)ulong_value; +#endif // !defined(ASIO_NO_DEPRECATED) + + std::string string_value = addr1.to_string(); +#if !defined(ASIO_NO_DEPRECATED) + string_value = addr1.to_string(ec); +#endif // !defined(ASIO_NO_DEPRECATED) + + // address_v4 static functions. + +#if !defined(ASIO_NO_DEPRECATED) + addr1 = ip::address_v4::from_string("127.0.0.1"); + addr1 = ip::address_v4::from_string("127.0.0.1", ec); + addr1 = ip::address_v4::from_string(string_value); + addr1 = ip::address_v4::from_string(string_value, ec); +#endif // !defined(ASIO_NO_DEPRECATED) + + addr1 = ip::address_v4::any(); + + addr1 = ip::address_v4::loopback(); + + addr1 = ip::address_v4::broadcast(); + +#if !defined(ASIO_NO_DEPRECATED) + addr1 = ip::address_v4::broadcast(addr2, addr3); + + addr1 = ip::address_v4::netmask(addr2); +#endif // !defined(ASIO_NO_DEPRECATED) + + // address_v4 comparisons. + + b = (addr1 == addr2); + (void)b; + + b = (addr1 != addr2); + (void)b; + + b = (addr1 < addr2); + (void)b; + + b = (addr1 > addr2); + (void)b; + + b = (addr1 <= addr2); + (void)b; + + b = (addr1 >= addr2); + (void)b; + + // address_v4 creation functions. + + addr1 = ip::make_address_v4(const_bytes_value); + addr1 = ip::make_address_v4(const_ulong_value); + addr1 = ip::make_address_v4("127.0.0.1"); + addr1 = ip::make_address_v4("127.0.0.1", ec); + addr1 = ip::make_address_v4(string_value); + addr1 = ip::make_address_v4(string_value, ec); +#if defined(ASIO_HAS_STRING_VIEW) +# if defined(ASIO_HAS_STD_STRING_VIEW) + std::string_view string_view_value("127.0.0.1"); +# elif defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW) + std::experimental::string_view string_view_value("127.0.0.1"); +# endif // defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW) + addr1 = ip::make_address_v4(string_view_value); + addr1 = ip::make_address_v4(string_view_value, ec); +#endif // defined(ASIO_HAS_STRING_VIEW) + + // address_v4 I/O. + + std::ostringstream os; + os << addr1; + +#if !defined(BOOST_NO_STD_WSTREAMBUF) + std::wostringstream wos; + wos << addr1; +#endif // !defined(BOOST_NO_STD_WSTREAMBUF) + } + catch (std::exception&) + { + } +} + +} // namespace ip_address_v4_compile + +//------------------------------------------------------------------------------ + +// ip_address_v4_runtime test +// ~~~~~~~~~~~~~~~~~~~~~~~~~~ +// The following test checks that the various public member functions meet the +// necessary postconditions. + +namespace ip_address_v4_runtime { + +void test() +{ + using asio::ip::address_v4; + + address_v4 a1; + ASIO_CHECK(a1.to_bytes()[0] == 0); + ASIO_CHECK(a1.to_bytes()[1] == 0); + ASIO_CHECK(a1.to_bytes()[2] == 0); + ASIO_CHECK(a1.to_bytes()[3] == 0); + ASIO_CHECK(a1.to_uint() == 0); +#if !defined(ASIO_NO_DEPRECATED) + ASIO_CHECK(a1.to_ulong() == 0); +#endif // !defined(ASIO_NO_DEPRECATED) + + address_v4::bytes_type b1 = {{ 1, 2, 3, 4 }}; + address_v4 a2(b1); + ASIO_CHECK(a2.to_bytes()[0] == 1); + ASIO_CHECK(a2.to_bytes()[1] == 2); + ASIO_CHECK(a2.to_bytes()[2] == 3); + ASIO_CHECK(a2.to_bytes()[3] == 4); + ASIO_CHECK(((a2.to_uint() >> 24) & 0xFF) == b1[0]); + ASIO_CHECK(((a2.to_uint() >> 16) & 0xFF) == b1[1]); + ASIO_CHECK(((a2.to_uint() >> 8) & 0xFF) == b1[2]); + ASIO_CHECK((a2.to_uint() & 0xFF) == b1[3]); +#if !defined(ASIO_NO_DEPRECATED) + ASIO_CHECK(((a2.to_ulong() >> 24) & 0xFF) == b1[0]); + ASIO_CHECK(((a2.to_ulong() >> 16) & 0xFF) == b1[1]); + ASIO_CHECK(((a2.to_ulong() >> 8) & 0xFF) == b1[2]); + ASIO_CHECK((a2.to_ulong() & 0xFF) == b1[3]); +#endif // !defined(ASIO_NO_DEPRECATED) + + address_v4 a3(0x01020304); + ASIO_CHECK(a3.to_bytes()[0] == 1); + ASIO_CHECK(a3.to_bytes()[1] == 2); + ASIO_CHECK(a3.to_bytes()[2] == 3); + ASIO_CHECK(a3.to_bytes()[3] == 4); + ASIO_CHECK(a3.to_uint() == 0x01020304); +#if !defined(ASIO_NO_DEPRECATED) + ASIO_CHECK(a3.to_ulong() == 0x01020304); +#endif // !defined(ASIO_NO_DEPRECATED) + + ASIO_CHECK(address_v4(0x7F000001).is_loopback()); + ASIO_CHECK(address_v4(0x7F000002).is_loopback()); + ASIO_CHECK(!address_v4(0x00000000).is_loopback()); + ASIO_CHECK(!address_v4(0x01020304).is_loopback()); + + ASIO_CHECK(address_v4(0x00000000).is_unspecified()); + ASIO_CHECK(!address_v4(0x7F000001).is_unspecified()); + ASIO_CHECK(!address_v4(0x01020304).is_unspecified()); + +#if !defined(ASIO_NO_DEPRECATED) + ASIO_CHECK(address_v4(0x01000000).is_class_a()); + ASIO_CHECK(address_v4(0x7F000000).is_class_a()); + ASIO_CHECK(!address_v4(0x80000000).is_class_a()); + ASIO_CHECK(!address_v4(0xBFFF0000).is_class_a()); + ASIO_CHECK(!address_v4(0xC0000000).is_class_a()); + ASIO_CHECK(!address_v4(0xDFFFFF00).is_class_a()); + ASIO_CHECK(!address_v4(0xE0000000).is_class_a()); + ASIO_CHECK(!address_v4(0xEFFFFFFF).is_class_a()); + ASIO_CHECK(!address_v4(0xF0000000).is_class_a()); + ASIO_CHECK(!address_v4(0xFFFFFFFF).is_class_a()); + + ASIO_CHECK(!address_v4(0x01000000).is_class_b()); + ASIO_CHECK(!address_v4(0x7F000000).is_class_b()); + ASIO_CHECK(address_v4(0x80000000).is_class_b()); + ASIO_CHECK(address_v4(0xBFFF0000).is_class_b()); + ASIO_CHECK(!address_v4(0xC0000000).is_class_b()); + ASIO_CHECK(!address_v4(0xDFFFFF00).is_class_b()); + ASIO_CHECK(!address_v4(0xE0000000).is_class_b()); + ASIO_CHECK(!address_v4(0xEFFFFFFF).is_class_b()); + ASIO_CHECK(!address_v4(0xF0000000).is_class_b()); + ASIO_CHECK(!address_v4(0xFFFFFFFF).is_class_b()); + + ASIO_CHECK(!address_v4(0x01000000).is_class_c()); + ASIO_CHECK(!address_v4(0x7F000000).is_class_c()); + ASIO_CHECK(!address_v4(0x80000000).is_class_c()); + ASIO_CHECK(!address_v4(0xBFFF0000).is_class_c()); + ASIO_CHECK(address_v4(0xC0000000).is_class_c()); + ASIO_CHECK(address_v4(0xDFFFFF00).is_class_c()); + ASIO_CHECK(!address_v4(0xE0000000).is_class_c()); + ASIO_CHECK(!address_v4(0xEFFFFFFF).is_class_c()); + ASIO_CHECK(!address_v4(0xF0000000).is_class_c()); + ASIO_CHECK(!address_v4(0xFFFFFFFF).is_class_c()); +#endif // !defined(ASIO_NO_DEPRECATED) + + ASIO_CHECK(!address_v4(0x01000000).is_multicast()); + ASIO_CHECK(!address_v4(0x7F000000).is_multicast()); + ASIO_CHECK(!address_v4(0x80000000).is_multicast()); + ASIO_CHECK(!address_v4(0xBFFF0000).is_multicast()); + ASIO_CHECK(!address_v4(0xC0000000).is_multicast()); + ASIO_CHECK(!address_v4(0xDFFFFF00).is_multicast()); + ASIO_CHECK(address_v4(0xE0000000).is_multicast()); + ASIO_CHECK(address_v4(0xEFFFFFFF).is_multicast()); + ASIO_CHECK(!address_v4(0xF0000000).is_multicast()); + ASIO_CHECK(!address_v4(0xFFFFFFFF).is_multicast()); + + address_v4 a4 = address_v4::any(); + ASIO_CHECK(a4.to_bytes()[0] == 0); + ASIO_CHECK(a4.to_bytes()[1] == 0); + ASIO_CHECK(a4.to_bytes()[2] == 0); + ASIO_CHECK(a4.to_bytes()[3] == 0); + ASIO_CHECK(a4.to_uint() == 0); +#if !defined(ASIO_NO_DEPRECATED) + ASIO_CHECK(a4.to_ulong() == 0); +#endif // !defined(ASIO_NO_DEPRECATED) + + address_v4 a5 = address_v4::loopback(); + ASIO_CHECK(a5.to_bytes()[0] == 0x7F); + ASIO_CHECK(a5.to_bytes()[1] == 0); + ASIO_CHECK(a5.to_bytes()[2] == 0); + ASIO_CHECK(a5.to_bytes()[3] == 0x01); + ASIO_CHECK(a5.to_uint() == 0x7F000001); +#if !defined(ASIO_NO_DEPRECATED) + ASIO_CHECK(a5.to_ulong() == 0x7F000001); +#endif // !defined(ASIO_NO_DEPRECATED) + + address_v4 a6 = address_v4::broadcast(); + ASIO_CHECK(a6.to_bytes()[0] == 0xFF); + ASIO_CHECK(a6.to_bytes()[1] == 0xFF); + ASIO_CHECK(a6.to_bytes()[2] == 0xFF); + ASIO_CHECK(a6.to_bytes()[3] == 0xFF); + ASIO_CHECK(a6.to_uint() == 0xFFFFFFFF); +#if !defined(ASIO_NO_DEPRECATED) + ASIO_CHECK(a6.to_ulong() == 0xFFFFFFFF); +#endif // !defined(ASIO_NO_DEPRECATED) + +#if !defined(ASIO_NO_DEPRECATED) + address_v4 class_a_net(0xFF000000); + address_v4 class_b_net(0xFFFF0000); + address_v4 class_c_net(0xFFFFFF00); + address_v4 other_net(0xFFFFFFFF); + ASIO_CHECK(address_v4::netmask(address_v4(0x01000000)) == class_a_net); + ASIO_CHECK(address_v4::netmask(address_v4(0x7F000000)) == class_a_net); + ASIO_CHECK(address_v4::netmask(address_v4(0x80000000)) == class_b_net); + ASIO_CHECK(address_v4::netmask(address_v4(0xBFFF0000)) == class_b_net); + ASIO_CHECK(address_v4::netmask(address_v4(0xC0000000)) == class_c_net); + ASIO_CHECK(address_v4::netmask(address_v4(0xDFFFFF00)) == class_c_net); + ASIO_CHECK(address_v4::netmask(address_v4(0xE0000000)) == other_net); + ASIO_CHECK(address_v4::netmask(address_v4(0xEFFFFFFF)) == other_net); + ASIO_CHECK(address_v4::netmask(address_v4(0xF0000000)) == other_net); + ASIO_CHECK(address_v4::netmask(address_v4(0xFFFFFFFF)) == other_net); +#endif // !defined(ASIO_NO_DEPRECATED) +} + +} // namespace ip_address_v4_runtime + +//------------------------------------------------------------------------------ + +ASIO_TEST_SUITE +( + "ip/address_v4", + ASIO_TEST_CASE(ip_address_v4_compile::test) + ASIO_TEST_CASE(ip_address_v4_runtime::test) +) diff --git a/boost-asio/test/ip/address_v4_iterator.cpp b/asio/asio/src/tests/unit/ip/address_v4_iterator.cpp similarity index 85% rename from boost-asio/test/ip/address_v4_iterator.cpp rename to asio/asio/src/tests/unit/ip/address_v4_iterator.cpp index 24097a494..edd8d441b 100644 --- a/boost-asio/test/ip/address_v4_iterator.cpp +++ b/asio/asio/src/tests/unit/ip/address_v4_iterator.cpp @@ -14,14 +14,14 @@ #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. -#include +#include "asio/ip/address_v4_iterator.hpp" #include "../unit_test.hpp" //------------------------------------------------------------------------------ -BOOST_ASIO_TEST_SUITE +ASIO_TEST_SUITE ( "ip/address_v4_iterator", - BOOST_ASIO_TEST_CASE(null_test) + ASIO_TEST_CASE(null_test) ) diff --git a/boost-asio/test/ip/address_v4_range.cpp b/asio/asio/src/tests/unit/ip/address_v4_range.cpp similarity index 85% rename from boost-asio/test/ip/address_v4_range.cpp rename to asio/asio/src/tests/unit/ip/address_v4_range.cpp index c9eb705d3..1621ca03a 100644 --- a/boost-asio/test/ip/address_v4_range.cpp +++ b/asio/asio/src/tests/unit/ip/address_v4_range.cpp @@ -14,14 +14,14 @@ #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. -#include +#include "asio/ip/address_v4_range.hpp" #include "../unit_test.hpp" //------------------------------------------------------------------------------ -BOOST_ASIO_TEST_SUITE +ASIO_TEST_SUITE ( "ip/address_v4_range", - BOOST_ASIO_TEST_CASE(null_test) + ASIO_TEST_CASE(null_test) ) diff --git a/asio/asio/src/tests/unit/ip/address_v6.cpp b/asio/asio/src/tests/unit/ip/address_v6.cpp new file mode 100644 index 000000000..266cf50b5 --- /dev/null +++ b/asio/asio/src/tests/unit/ip/address_v6.cpp @@ -0,0 +1,409 @@ +// +// address_v6.cpp +// ~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2018 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) +// + +// Disable autolinking for unit tests. +#if !defined(BOOST_ALL_NO_LIB) +#define BOOST_ALL_NO_LIB 1 +#endif // !defined(BOOST_ALL_NO_LIB) + +// Test that header file is self-contained. +#include "asio/ip/address_v6.hpp" + +#include "../unit_test.hpp" +#include + +//------------------------------------------------------------------------------ + +// ip_address_v6_compile test +// ~~~~~~~~~~~~~~~~~~~~~~~~~~ +// The following test checks that all public member functions on the class +// ip::address_v6 compile and link correctly. Runtime failures are ignored. + +namespace ip_address_v6_compile { + +void test() +{ + using namespace asio; + namespace ip = asio::ip; + + try + { + asio::error_code ec; + + // address_v6 constructors. + + ip::address_v6 addr1; + const ip::address_v6::bytes_type const_bytes_value = { { 0 } }; + ip::address_v6 addr2(const_bytes_value); + + // address_v6 functions. + + unsigned long scope_id = addr1.scope_id(); + addr1.scope_id(scope_id); + + bool b = addr1.is_unspecified(); + (void)b; + + b = addr1.is_loopback(); + (void)b; + + b = addr1.is_multicast(); + (void)b; + + b = addr1.is_link_local(); + (void)b; + + b = addr1.is_site_local(); + (void)b; + + b = addr1.is_v4_mapped(); + (void)b; + +#if !defined(ASIO_NO_DEPRECATED) + b = addr1.is_v4_compatible(); + (void)b; +#endif // !defined(ASIO_NO_DEPRECATED) + + b = addr1.is_multicast_node_local(); + (void)b; + + b = addr1.is_multicast_link_local(); + (void)b; + + b = addr1.is_multicast_site_local(); + (void)b; + + b = addr1.is_multicast_org_local(); + (void)b; + + b = addr1.is_multicast_global(); + (void)b; + + ip::address_v6::bytes_type bytes_value = addr1.to_bytes(); + (void)bytes_value; + + std::string string_value = addr1.to_string(); +#if !defined(ASIO_NO_DEPRECATED) + string_value = addr1.to_string(ec); +#endif // !defined(ASIO_NO_DEPRECATED) + +#if !defined(ASIO_NO_DEPRECATED) + ip::address_v4 addr3 = addr1.to_v4(); +#endif // !defined(ASIO_NO_DEPRECATED) + + // address_v6 static functions. + +#if !defined(ASIO_NO_DEPRECATED) + addr1 = ip::address_v6::from_string("0::0"); + addr1 = ip::address_v6::from_string("0::0", ec); + addr1 = ip::address_v6::from_string(string_value); + addr1 = ip::address_v6::from_string(string_value, ec); +#endif // !defined(ASIO_NO_DEPRECATED) + + addr1 = ip::address_v6::any(); + + addr1 = ip::address_v6::loopback(); + +#if !defined(ASIO_NO_DEPRECATED) + addr1 = ip::address_v6::v4_mapped(addr3); + + addr1 = ip::address_v6::v4_compatible(addr3); +#endif // !defined(ASIO_NO_DEPRECATED) + + // address_v6 comparisons. + + b = (addr1 == addr2); + (void)b; + + b = (addr1 != addr2); + (void)b; + + b = (addr1 < addr2); + (void)b; + + b = (addr1 > addr2); + (void)b; + + b = (addr1 <= addr2); + (void)b; + + b = (addr1 >= addr2); + (void)b; + + // address_v6 creation functions. + + addr1 = ip::make_address_v6(const_bytes_value, scope_id); + addr1 = ip::make_address_v6("0::0"); + addr1 = ip::make_address_v6("0::0", ec); + addr1 = ip::make_address_v6(string_value); + addr1 = ip::make_address_v6(string_value, ec); +#if defined(ASIO_HAS_STRING_VIEW) +# if defined(ASIO_HAS_STD_STRING_VIEW) + std::string_view string_view_value("0::0"); +# else // defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW) + std::experimental::string_view string_view_value("0::0"); +# endif // defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW) + addr1 = ip::make_address_v6(string_view_value); + addr1 = ip::make_address_v6(string_view_value, ec); +#endif // defined(ASIO_HAS_STRING_VIEW) + + // address_v6 IPv4-mapped conversion. +#if defined(ASIO_NO_DEPRECATED) + ip::address_v4 addr3; +#endif // defined(ASIO_NO_DEPRECATED) + addr1 = ip::make_address_v6(ip::v4_mapped, addr3); + addr3 = ip::make_address_v4(ip::v4_mapped, addr1); + + // address_v6 I/O. + + std::ostringstream os; + os << addr1; + +#if !defined(BOOST_NO_STD_WSTREAMBUF) + std::wostringstream wos; + wos << addr1; +#endif // !defined(BOOST_NO_STD_WSTREAMBUF) + } + catch (std::exception&) + { + } +} + +} // namespace ip_address_v6_compile + +//------------------------------------------------------------------------------ + +// ip_address_v6_runtime test +// ~~~~~~~~~~~~~~~~~~~~~~~~~~ +// The following test checks that the various public member functions meet the +// necessary postconditions. + +namespace ip_address_v6_runtime { + +void test() +{ + using asio::ip::address_v6; + + address_v6 a1; + ASIO_CHECK(a1.is_unspecified()); + ASIO_CHECK(a1.scope_id() == 0); + + address_v6::bytes_type b1 = {{ 1, 2, 3, 4, 5, + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }}; + address_v6 a2(b1, 12345); + ASIO_CHECK(a2.to_bytes()[0] == 1); + ASIO_CHECK(a2.to_bytes()[1] == 2); + ASIO_CHECK(a2.to_bytes()[2] == 3); + ASIO_CHECK(a2.to_bytes()[3] == 4); + ASIO_CHECK(a2.to_bytes()[4] == 5); + ASIO_CHECK(a2.to_bytes()[5] == 6); + ASIO_CHECK(a2.to_bytes()[6] == 7); + ASIO_CHECK(a2.to_bytes()[7] == 8); + ASIO_CHECK(a2.to_bytes()[8] == 9); + ASIO_CHECK(a2.to_bytes()[9] == 10); + ASIO_CHECK(a2.to_bytes()[10] == 11); + ASIO_CHECK(a2.to_bytes()[11] == 12); + ASIO_CHECK(a2.to_bytes()[12] == 13); + ASIO_CHECK(a2.to_bytes()[13] == 14); + ASIO_CHECK(a2.to_bytes()[14] == 15); + ASIO_CHECK(a2.to_bytes()[15] == 16); + ASIO_CHECK(a2.scope_id() == 12345); + + address_v6 a3; + a3.scope_id(12345); + ASIO_CHECK(a3.scope_id() == 12345); + + address_v6 unspecified_address; + address_v6::bytes_type loopback_bytes = {{ 0 }}; + loopback_bytes[15] = 1; + address_v6 loopback_address(loopback_bytes); + address_v6::bytes_type link_local_bytes = {{ 0xFE, 0x80, 1 }}; + address_v6 link_local_address(link_local_bytes); + address_v6::bytes_type site_local_bytes = {{ 0xFE, 0xC0, 1 }}; + address_v6 site_local_address(site_local_bytes); + address_v6::bytes_type v4_mapped_bytes = {{ 0 }}; + v4_mapped_bytes[10] = 0xFF, v4_mapped_bytes[11] = 0xFF; + v4_mapped_bytes[12] = 1, v4_mapped_bytes[13] = 2; + v4_mapped_bytes[14] = 3, v4_mapped_bytes[15] = 4; + address_v6 v4_mapped_address(v4_mapped_bytes); + address_v6::bytes_type v4_compat_bytes = {{ 0 }}; + v4_compat_bytes[12] = 1, v4_compat_bytes[13] = 2; + v4_compat_bytes[14] = 3, v4_compat_bytes[15] = 4; + address_v6 v4_compat_address(v4_compat_bytes); + address_v6::bytes_type mcast_global_bytes = {{ 0xFF, 0x0E, 1 }}; + address_v6 mcast_global_address(mcast_global_bytes); + address_v6::bytes_type mcast_link_local_bytes = {{ 0xFF, 0x02, 1 }}; + address_v6 mcast_link_local_address(mcast_link_local_bytes); + address_v6::bytes_type mcast_node_local_bytes = {{ 0xFF, 0x01, 1 }}; + address_v6 mcast_node_local_address(mcast_node_local_bytes); + address_v6::bytes_type mcast_org_local_bytes = {{ 0xFF, 0x08, 1 }}; + address_v6 mcast_org_local_address(mcast_org_local_bytes); + address_v6::bytes_type mcast_site_local_bytes = {{ 0xFF, 0x05, 1 }}; + address_v6 mcast_site_local_address(mcast_site_local_bytes); + + ASIO_CHECK(!unspecified_address.is_loopback()); + ASIO_CHECK(loopback_address.is_loopback()); + ASIO_CHECK(!link_local_address.is_loopback()); + ASIO_CHECK(!site_local_address.is_loopback()); + ASIO_CHECK(!v4_mapped_address.is_loopback()); + ASIO_CHECK(!v4_compat_address.is_loopback()); + ASIO_CHECK(!mcast_global_address.is_loopback()); + ASIO_CHECK(!mcast_link_local_address.is_loopback()); + ASIO_CHECK(!mcast_node_local_address.is_loopback()); + ASIO_CHECK(!mcast_org_local_address.is_loopback()); + ASIO_CHECK(!mcast_site_local_address.is_loopback()); + + ASIO_CHECK(unspecified_address.is_unspecified()); + ASIO_CHECK(!loopback_address.is_unspecified()); + ASIO_CHECK(!link_local_address.is_unspecified()); + ASIO_CHECK(!site_local_address.is_unspecified()); + ASIO_CHECK(!v4_mapped_address.is_unspecified()); + ASIO_CHECK(!v4_compat_address.is_unspecified()); + ASIO_CHECK(!mcast_global_address.is_unspecified()); + ASIO_CHECK(!mcast_link_local_address.is_unspecified()); + ASIO_CHECK(!mcast_node_local_address.is_unspecified()); + ASIO_CHECK(!mcast_org_local_address.is_unspecified()); + ASIO_CHECK(!mcast_site_local_address.is_unspecified()); + + ASIO_CHECK(!unspecified_address.is_link_local()); + ASIO_CHECK(!loopback_address.is_link_local()); + ASIO_CHECK(link_local_address.is_link_local()); + ASIO_CHECK(!site_local_address.is_link_local()); + ASIO_CHECK(!v4_mapped_address.is_link_local()); + ASIO_CHECK(!v4_compat_address.is_link_local()); + ASIO_CHECK(!mcast_global_address.is_link_local()); + ASIO_CHECK(!mcast_link_local_address.is_link_local()); + ASIO_CHECK(!mcast_node_local_address.is_link_local()); + ASIO_CHECK(!mcast_org_local_address.is_link_local()); + ASIO_CHECK(!mcast_site_local_address.is_link_local()); + + ASIO_CHECK(!unspecified_address.is_site_local()); + ASIO_CHECK(!loopback_address.is_site_local()); + ASIO_CHECK(!link_local_address.is_site_local()); + ASIO_CHECK(site_local_address.is_site_local()); + ASIO_CHECK(!v4_mapped_address.is_site_local()); + ASIO_CHECK(!v4_compat_address.is_site_local()); + ASIO_CHECK(!mcast_global_address.is_site_local()); + ASIO_CHECK(!mcast_link_local_address.is_site_local()); + ASIO_CHECK(!mcast_node_local_address.is_site_local()); + ASIO_CHECK(!mcast_org_local_address.is_site_local()); + ASIO_CHECK(!mcast_site_local_address.is_site_local()); + + ASIO_CHECK(!unspecified_address.is_v4_mapped()); + ASIO_CHECK(!loopback_address.is_v4_mapped()); + ASIO_CHECK(!link_local_address.is_v4_mapped()); + ASIO_CHECK(!site_local_address.is_v4_mapped()); + ASIO_CHECK(v4_mapped_address.is_v4_mapped()); + ASIO_CHECK(!v4_compat_address.is_v4_mapped()); + ASIO_CHECK(!mcast_global_address.is_v4_mapped()); + ASIO_CHECK(!mcast_link_local_address.is_v4_mapped()); + ASIO_CHECK(!mcast_node_local_address.is_v4_mapped()); + ASIO_CHECK(!mcast_org_local_address.is_v4_mapped()); + ASIO_CHECK(!mcast_site_local_address.is_v4_mapped()); + +#if !defined(ASIO_NO_DEPRECATED) + ASIO_CHECK(!unspecified_address.is_v4_compatible()); + ASIO_CHECK(!loopback_address.is_v4_compatible()); + ASIO_CHECK(!link_local_address.is_v4_compatible()); + ASIO_CHECK(!site_local_address.is_v4_compatible()); + ASIO_CHECK(!v4_mapped_address.is_v4_compatible()); + ASIO_CHECK(v4_compat_address.is_v4_compatible()); + ASIO_CHECK(!mcast_global_address.is_v4_compatible()); + ASIO_CHECK(!mcast_link_local_address.is_v4_compatible()); + ASIO_CHECK(!mcast_node_local_address.is_v4_compatible()); + ASIO_CHECK(!mcast_org_local_address.is_v4_compatible()); + ASIO_CHECK(!mcast_site_local_address.is_v4_compatible()); +#endif // !defined(ASIO_NO_DEPRECATED) + + ASIO_CHECK(!unspecified_address.is_multicast()); + ASIO_CHECK(!loopback_address.is_multicast()); + ASIO_CHECK(!link_local_address.is_multicast()); + ASIO_CHECK(!site_local_address.is_multicast()); + ASIO_CHECK(!v4_mapped_address.is_multicast()); + ASIO_CHECK(!v4_compat_address.is_multicast()); + ASIO_CHECK(mcast_global_address.is_multicast()); + ASIO_CHECK(mcast_link_local_address.is_multicast()); + ASIO_CHECK(mcast_node_local_address.is_multicast()); + ASIO_CHECK(mcast_org_local_address.is_multicast()); + ASIO_CHECK(mcast_site_local_address.is_multicast()); + + ASIO_CHECK(!unspecified_address.is_multicast_global()); + ASIO_CHECK(!loopback_address.is_multicast_global()); + ASIO_CHECK(!link_local_address.is_multicast_global()); + ASIO_CHECK(!site_local_address.is_multicast_global()); + ASIO_CHECK(!v4_mapped_address.is_multicast_global()); + ASIO_CHECK(!v4_compat_address.is_multicast_global()); + ASIO_CHECK(mcast_global_address.is_multicast_global()); + ASIO_CHECK(!mcast_link_local_address.is_multicast_global()); + ASIO_CHECK(!mcast_node_local_address.is_multicast_global()); + ASIO_CHECK(!mcast_org_local_address.is_multicast_global()); + ASIO_CHECK(!mcast_site_local_address.is_multicast_global()); + + ASIO_CHECK(!unspecified_address.is_multicast_link_local()); + ASIO_CHECK(!loopback_address.is_multicast_link_local()); + ASIO_CHECK(!link_local_address.is_multicast_link_local()); + ASIO_CHECK(!site_local_address.is_multicast_link_local()); + ASIO_CHECK(!v4_mapped_address.is_multicast_link_local()); + ASIO_CHECK(!v4_compat_address.is_multicast_link_local()); + ASIO_CHECK(!mcast_global_address.is_multicast_link_local()); + ASIO_CHECK(mcast_link_local_address.is_multicast_link_local()); + ASIO_CHECK(!mcast_node_local_address.is_multicast_link_local()); + ASIO_CHECK(!mcast_org_local_address.is_multicast_link_local()); + ASIO_CHECK(!mcast_site_local_address.is_multicast_link_local()); + + ASIO_CHECK(!unspecified_address.is_multicast_node_local()); + ASIO_CHECK(!loopback_address.is_multicast_node_local()); + ASIO_CHECK(!link_local_address.is_multicast_node_local()); + ASIO_CHECK(!site_local_address.is_multicast_node_local()); + ASIO_CHECK(!v4_mapped_address.is_multicast_node_local()); + ASIO_CHECK(!v4_compat_address.is_multicast_node_local()); + ASIO_CHECK(!mcast_global_address.is_multicast_node_local()); + ASIO_CHECK(!mcast_link_local_address.is_multicast_node_local()); + ASIO_CHECK(mcast_node_local_address.is_multicast_node_local()); + ASIO_CHECK(!mcast_org_local_address.is_multicast_node_local()); + ASIO_CHECK(!mcast_site_local_address.is_multicast_node_local()); + + ASIO_CHECK(!unspecified_address.is_multicast_org_local()); + ASIO_CHECK(!loopback_address.is_multicast_org_local()); + ASIO_CHECK(!link_local_address.is_multicast_org_local()); + ASIO_CHECK(!site_local_address.is_multicast_org_local()); + ASIO_CHECK(!v4_mapped_address.is_multicast_org_local()); + ASIO_CHECK(!v4_compat_address.is_multicast_org_local()); + ASIO_CHECK(!mcast_global_address.is_multicast_org_local()); + ASIO_CHECK(!mcast_link_local_address.is_multicast_org_local()); + ASIO_CHECK(!mcast_node_local_address.is_multicast_org_local()); + ASIO_CHECK(mcast_org_local_address.is_multicast_org_local()); + ASIO_CHECK(!mcast_site_local_address.is_multicast_org_local()); + + ASIO_CHECK(!unspecified_address.is_multicast_site_local()); + ASIO_CHECK(!loopback_address.is_multicast_site_local()); + ASIO_CHECK(!link_local_address.is_multicast_site_local()); + ASIO_CHECK(!site_local_address.is_multicast_site_local()); + ASIO_CHECK(!v4_mapped_address.is_multicast_site_local()); + ASIO_CHECK(!v4_compat_address.is_multicast_site_local()); + ASIO_CHECK(!mcast_global_address.is_multicast_site_local()); + ASIO_CHECK(!mcast_link_local_address.is_multicast_site_local()); + ASIO_CHECK(!mcast_node_local_address.is_multicast_site_local()); + ASIO_CHECK(!mcast_org_local_address.is_multicast_site_local()); + ASIO_CHECK(mcast_site_local_address.is_multicast_site_local()); + + ASIO_CHECK(address_v6::loopback().is_loopback()); +} + +} // namespace ip_address_v6_runtime + +//------------------------------------------------------------------------------ + +ASIO_TEST_SUITE +( + "ip/address_v6", + ASIO_TEST_CASE(ip_address_v6_compile::test) + ASIO_TEST_CASE(ip_address_v6_runtime::test) +) diff --git a/boost-asio/test/ip/address_v6_iterator.cpp b/asio/asio/src/tests/unit/ip/address_v6_iterator.cpp similarity index 85% rename from boost-asio/test/ip/address_v6_iterator.cpp rename to asio/asio/src/tests/unit/ip/address_v6_iterator.cpp index 1487d471d..cf5859e87 100644 --- a/boost-asio/test/ip/address_v6_iterator.cpp +++ b/asio/asio/src/tests/unit/ip/address_v6_iterator.cpp @@ -14,14 +14,14 @@ #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. -#include +#include "asio/ip/address_v6_iterator.hpp" #include "../unit_test.hpp" //------------------------------------------------------------------------------ -BOOST_ASIO_TEST_SUITE +ASIO_TEST_SUITE ( "ip/address_v6_iterator", - BOOST_ASIO_TEST_CASE(null_test) + ASIO_TEST_CASE(null_test) ) diff --git a/boost-asio/test/ip/address_v6_range.cpp b/asio/asio/src/tests/unit/ip/address_v6_range.cpp similarity index 85% rename from boost-asio/test/ip/address_v6_range.cpp rename to asio/asio/src/tests/unit/ip/address_v6_range.cpp index 363b0c269..fa1015928 100644 --- a/boost-asio/test/ip/address_v6_range.cpp +++ b/asio/asio/src/tests/unit/ip/address_v6_range.cpp @@ -14,14 +14,14 @@ #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. -#include +#include "asio/ip/address_v6_range.hpp" #include "../unit_test.hpp" //------------------------------------------------------------------------------ -BOOST_ASIO_TEST_SUITE +ASIO_TEST_SUITE ( "ip/address_v6_range", - BOOST_ASIO_TEST_CASE(null_test) + ASIO_TEST_CASE(null_test) ) diff --git a/boost-asio/doc/.gitignore b/boost-asio/doc/.gitignore deleted file mode 100644 index 35b5e99ae..000000000 --- a/boost-asio/doc/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/html diff --git a/boost-asio/doc/Jamfile.v2 b/boost-asio/doc/Jamfile.v2 deleted file mode 100644 index 1149b41de..000000000 --- a/boost-asio/doc/Jamfile.v2 +++ /dev/null @@ -1,118 +0,0 @@ -# -# Copyright (c) 2003-2018 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) -# - -using quickbook ; - -######################################################################## -# Standalone HTML documentation - -xml standalone_doc - : - asio.qbk - ; - -install images - : - overview/proactor.png - overview/sync_op.png - overview/async_op1.png - overview/async_op2.png - : - html/boost_asio - ; - -local example-names = cpp03/allocation cpp03/buffers cpp03/chat cpp03/echo - cpp03/fork cpp03/http/client cpp03/http/server cpp03/http/server2 - cpp03/http/server3 cpp03/http/server4 cpp03/icmp cpp03/invocation - cpp03/iostreams cpp03/local cpp03/multicast cpp03/nonblocking cpp03/porthopper - cpp03/serialization cpp03/services cpp03/socks4 cpp03/spawn cpp03/ssl - cpp03/timeouts cpp03/timers cpp03/windows cpp11/allocation cpp11/buffers - cpp11/chat cpp11/echo cpp11/executors cpp11/fork cpp11/futures - cpp11/handler_tracking cpp11/http/server cpp11/invocation cpp11/local - cpp11/multicast cpp11/nonblockng cpp11/spawn cpp17/coroutines_ts ; - -for local l in $(example-names) -{ - install ex_$(l) : [ glob ../example/$(l)/*.*pp ] : html/boost_asio/example/$(l) ; -} - -boostbook standalone - : - standalone_doc - : - boost.root=../../../.. - chapter.autolabel=0 - chunk.section.depth=8 - chunk.first.sections=1 - toc.section.depth=2 - toc.max.depth=1 - generate.section.toc.level=1 - generate.toc="chapter nop section nop" - pdf:boost.url.prefix=http://www.boost.org/doc/libs/release/libs/asio/doc/html - ; - -######################################################################## -# HTML documentation for $(BOOST_ROOT)/doc/html - -xml asio_doc - : - asio.qbk - ; - -explicit asio_doc ; - -install asio_doc_images - : - overview/proactor.png - overview/sync_op.png - overview/async_op1.png - overview/async_op2.png - : - $(BOOST_ROOT)/doc/html/boost_asio - ; - -explicit asio_doc_images ; - -for local l in $(example-names) -{ - install asio_ex_$(l) : [ glob ../example/$(l)/*.*pp ] : $(BOOST_ROOT)/doc/html/boost_asio/example/$(l) ; - explicit asio_ex_$(l) ; -} - -alias asio_examples : asio_ex_$(example-names) ; - -explicit asio_examples ; - -path-constant images_location : ../../../doc/html ; - -boostbook asio - : - asio_doc - : - ../../../doc/html - chapter.autolabel=0 - chunk.section.depth=8 - chunk.first.sections=1 - toc.section.depth=2 - toc.max.depth=1 - generate.section.toc.level=1 - generate.toc="chapter nop section nop" - root.filename=boost_asio - pdf:img.src.path=$(images_location)/ - pdf:boost.url.prefix=http://www.boost.org/doc/libs/release/libs/asio/doc/html - : - asio_doc_images - asio_examples - ; - -explicit asio ; - -############################################################################### -alias boostdoc ; -explicit boostdoc ; -alias boostrelease : asio ; -explicit boostrelease ; diff --git a/boost-asio/doc/asio.qbk b/boost-asio/doc/asio.qbk deleted file mode 100644 index 8c5533c00..000000000 --- a/boost-asio/doc/asio.qbk +++ /dev/null @@ -1,127 +0,0 @@ -[/ - / Copyright (c) 2003-2018 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) - /] - -[library Boost.Asio - [quickbook 1.4] - [copyright 2003 - 2018 Christopher M. Kohlhoff] - [purpose Networking library] - [license - 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]) - ] - [authors [Kohlhoff, Christopher]] - [category template] - [category generic] -] - -[template mdash[] '''— '''] -[template half_open_range[text] '''['''[text])] -[template indexterm1[id term1] ''''''[term1]''''''] -[template indexterm2[id term1 term2] ''''''[term1]''''''[term2]''''''] -[template inline_note[text] \[['Note:] [text] '''—'''['end note]\] ] -[template ticket[number]''''''#[number]''''''] -[def __POSIX__ /POSIX/] -[def __Windows__ /Windows/] -[def __accept__ [@http://www.opengroup.org/onlinepubs/000095399/functions/accept.html `accept()`]] -[def __connect__ [@http://www.opengroup.org/onlinepubs/000095399/functions/connect.html `connect()`]] -[def __getpeername__ [@http://www.opengroup.org/onlinepubs/000095399/functions/getpeername.html `getpeername()`]] -[def __getsockname__ [@http://www.opengroup.org/onlinepubs/000095399/functions/getsockname.html `getsockname()`]] -[def __getsockopt__ [@http://www.opengroup.org/onlinepubs/000095399/functions/getsockopt.html `getsockopt()`]] -[def __ioctl__ [@http://www.opengroup.org/onlinepubs/000095399/functions/ioctl.html `ioctl()`]] -[def __poll__ [@http://www.opengroup.org/onlinepubs/000095399/functions/poll.html `poll()`]] -[def __recvfrom__ [@http://www.opengroup.org/onlinepubs/000095399/functions/recvfrom.html `recvfrom()`]] -[def __sendto__ [@http://www.opengroup.org/onlinepubs/000095399/functions/sendto.html `sendto()`]] -[def __setsockopt__ [@http://www.opengroup.org/onlinepubs/000095399/functions/setsockopt.html `setsockopt()`]] -[def __shutdown__ [@http://www.opengroup.org/onlinepubs/000095399/functions/shutdown.html `shutdown()`]] -[def __socket__ [@http://www.opengroup.org/onlinepubs/000095399/functions/socket.html `socket()`]] - -[/=============================================================================] - -Boost.Asio is a cross-platform C++ library for network and low-level I/O programming -that provides developers with a consistent asynchronous model using a modern -C++ approach. - -[variablelist - [ - [ - [link boost_asio.overview Overview] - ] - [ - An overview of the features included in Boost.Asio, plus rationale and design information. - ] - ] - [ - [ - [link boost_asio.using Using Boost.Asio] - ] - [ - How to use Boost.Asio in your applications. Includes information on - library dependencies and supported platforms. - ] - ] - [ - [ - [link boost_asio.tutorial Tutorial] - ] - [ - A tutorial that introduces the fundamental concepts required to use - Boost.Asio, and shows how to use Boost.Asio to develop simple client and - server programs. - ] - ] - [ - [ - [link boost_asio.examples Examples] - ] - [ - Examples that illustrate the use of Boost.Asio in more complex applications. - ] - ] - [ - [ - [link boost_asio.reference Reference] - ] - [ - Detailed class and function reference. - ] - ] - [ - [ - [link boost_asio.net_ts Networking TS Compatibility] - ] - [ - Description of changes to provide compatibility with the "C++ Extensions - for Networking" Technical Specification. - ] - ] - [ - [ - [link boost_asio.history Revision History] - ] - [ - Log of Boost.Asio changes made in each Boost release. - ] - ] - [ - [ - [link boost_asio.index Index] - ] - [ - Book-style text index of Boost.Asio documentation. - ] - ] -] - -[include overview.qbk] -[include using.qbk] -[include tutorial.qbk] -[include examples.qbk] -[include reference.qbk] -[include net_ts.qbk] -[include history.qbk] -[xinclude index.xml] diff --git a/boost-asio/doc/doxy2qbk.pl b/boost-asio/doc/doxy2qbk.pl deleted file mode 100644 index 7d5991a5a..000000000 --- a/boost-asio/doc/doxy2qbk.pl +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/perl -w - -# Copyright (c) 2003-2018 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) - -use strict; - -system("doxygen reference.dox"); -chdir("xml"); -system("xsltproc combine.xslt index.xml > all.xml"); -chdir(".."); -system("xsltproc reference.xsl xml/all.xml > reference.qbk"); -system("rm -rf xml"); - -system("doxygen tutorial.dox"); -chdir("xml"); -system("xsltproc combine.xslt index.xml > all.xml"); -chdir(".."); -system("xsltproc tutorial.xsl xml/all.xml > tutorial.qbk"); -system("rm -rf xml reference.tags"); diff --git a/boost-asio/doc/examples.qbk b/boost-asio/doc/examples.qbk deleted file mode 100644 index 7123d809e..000000000 --- a/boost-asio/doc/examples.qbk +++ /dev/null @@ -1,485 +0,0 @@ -[/ - / Copyright (c) 2003-2018 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:examples Examples] - - -* [link boost_asio.examples.cpp03_examples C++03 Examples]: Illustrates the use of -Boost.Asio using only C++03 language and library features. Where necessary, the -examples make use of selected Boost C++ libraries. - -* [link boost_asio.examples.cpp11_examples C++11 Examples]: Contains a limited set of -the C++03 Boost.Asio examples, updated to use only C++11 library and language -facilities. These examples do not make direct use of Boost C++ libraries. - -* [link boost_asio.examples.cpp17_examples C++17 Examples]: Selected examples -illustrating C++17 usage in conjunction with Technical Specifications. - - -[section:cpp03_examples C++03 Examples] - - -[heading Allocation] - -This example shows how to customise the allocation of memory associated with -asynchronous operations. - -* [@boost_asio/example/cpp03/allocation/server.cpp] - - -[heading Buffers] - -This example demonstrates how to create reference counted buffers that can be -used with socket read and write operations. - -* [@boost_asio/example/cpp03/buffers/reference_counted.cpp] - - -[heading Chat] - -This example implements a chat server and client. The programs use a custom -protocol with a fixed length message header and variable length message body. - -* [@boost_asio/example/cpp03/chat/chat_message.hpp] -* [@boost_asio/example/cpp03/chat/chat_client.cpp] -* [@boost_asio/example/cpp03/chat/chat_server.cpp] - -The following POSIX-specific chat client demonstrates how to use the -[link boost_asio.reference.posix__stream_descriptor posix::stream_descriptor] class to -perform console input and output. - -* [@boost_asio/example/cpp03/chat/posix_chat_client.cpp] - - -[heading Echo] - -A collection of simple clients and servers, showing the use of both synchronous -and asynchronous operations. - -* [@boost_asio/example/cpp03/echo/async_tcp_echo_server.cpp] -* [@boost_asio/example/cpp03/echo/async_udp_echo_server.cpp] -* [@boost_asio/example/cpp03/echo/blocking_tcp_echo_client.cpp] -* [@boost_asio/example/cpp03/echo/blocking_tcp_echo_server.cpp] -* [@boost_asio/example/cpp03/echo/blocking_udp_echo_client.cpp] -* [@boost_asio/example/cpp03/echo/blocking_udp_echo_server.cpp] - - -[heading Fork] - -These POSIX-specific examples show how to use Boost.Asio in conjunction with the -`fork()` system call. The first example illustrates the steps required to start -a daemon process: - -* [@boost_asio/example/cpp03/fork/daemon.cpp] - -The second example demonstrates how it is possible to fork a process from -within a completion handler. - -* [@boost_asio/example/cpp03/fork/process_per_connection.cpp] - - -[heading HTTP Client] - -Example programs implementing simple HTTP 1.0 clients. These examples show how -to use the [link boost_asio.reference.read_until read_until] and [link -boost_asio.reference.async_read_until async_read_until] functions. - -* [@boost_asio/example/cpp03/http/client/sync_client.cpp] -* [@boost_asio/example/cpp03/http/client/async_client.cpp] - - -[heading HTTP Server] - -This example illustrates the use of asio in a simple single-threaded server -implementation of HTTP 1.0. It demonstrates how to perform a clean shutdown by -cancelling all outstanding asynchronous operations. - -* [@boost_asio/example/cpp03/http/server/connection.cpp] -* [@boost_asio/example/cpp03/http/server/connection.hpp] -* [@boost_asio/example/cpp03/http/server/connection_manager.cpp] -* [@boost_asio/example/cpp03/http/server/connection_manager.hpp] -* [@boost_asio/example/cpp03/http/server/header.hpp] -* [@boost_asio/example/cpp03/http/server/main.cpp] -* [@boost_asio/example/cpp03/http/server/mime_types.cpp] -* [@boost_asio/example/cpp03/http/server/mime_types.hpp] -* [@boost_asio/example/cpp03/http/server/reply.cpp] -* [@boost_asio/example/cpp03/http/server/reply.hpp] -* [@boost_asio/example/cpp03/http/server/request.hpp] -* [@boost_asio/example/cpp03/http/server/request_handler.cpp] -* [@boost_asio/example/cpp03/http/server/request_handler.hpp] -* [@boost_asio/example/cpp03/http/server/request_parser.cpp] -* [@boost_asio/example/cpp03/http/server/request_parser.hpp] -* [@boost_asio/example/cpp03/http/server/server.cpp] -* [@boost_asio/example/cpp03/http/server/server.hpp] - - -[heading HTTP Server 2] - -An HTTP server using an io_context-per-CPU design. - -* [@boost_asio/example/cpp03/http/server2/connection.cpp] -* [@boost_asio/example/cpp03/http/server2/connection.hpp] -* [@boost_asio/example/cpp03/http/server2/header.hpp] -* [@boost_asio/example/cpp03/http/server2/io_context_pool.cpp] -* [@boost_asio/example/cpp03/http/server2/io_context_pool.hpp] -* [@boost_asio/example/cpp03/http/server2/main.cpp] -* [@boost_asio/example/cpp03/http/server2/mime_types.cpp] -* [@boost_asio/example/cpp03/http/server2/mime_types.hpp] -* [@boost_asio/example/cpp03/http/server2/reply.cpp] -* [@boost_asio/example/cpp03/http/server2/reply.hpp] -* [@boost_asio/example/cpp03/http/server2/request.hpp] -* [@boost_asio/example/cpp03/http/server2/request_handler.cpp] -* [@boost_asio/example/cpp03/http/server2/request_handler.hpp] -* [@boost_asio/example/cpp03/http/server2/request_parser.cpp] -* [@boost_asio/example/cpp03/http/server2/request_parser.hpp] -* [@boost_asio/example/cpp03/http/server2/server.cpp] -* [@boost_asio/example/cpp03/http/server2/server.hpp] - - -[heading HTTP Server 3] - -An HTTP server using a single io_context and a thread pool calling `io_context::run()`. - -* [@boost_asio/example/cpp03/http/server3/connection.cpp] -* [@boost_asio/example/cpp03/http/server3/connection.hpp] -* [@boost_asio/example/cpp03/http/server3/header.hpp] -* [@boost_asio/example/cpp03/http/server3/main.cpp] -* [@boost_asio/example/cpp03/http/server3/mime_types.cpp] -* [@boost_asio/example/cpp03/http/server3/mime_types.hpp] -* [@boost_asio/example/cpp03/http/server3/reply.cpp] -* [@boost_asio/example/cpp03/http/server3/reply.hpp] -* [@boost_asio/example/cpp03/http/server3/request.hpp] -* [@boost_asio/example/cpp03/http/server3/request_handler.cpp] -* [@boost_asio/example/cpp03/http/server3/request_handler.hpp] -* [@boost_asio/example/cpp03/http/server3/request_parser.cpp] -* [@boost_asio/example/cpp03/http/server3/request_parser.hpp] -* [@boost_asio/example/cpp03/http/server3/server.cpp] -* [@boost_asio/example/cpp03/http/server3/server.hpp] - - -[heading HTTP Server 4] - -A single-threaded HTTP server implemented using stackless coroutines. - -* [@boost_asio/example/cpp03/http/server4/file_handler.cpp] -* [@boost_asio/example/cpp03/http/server4/file_handler.hpp] -* [@boost_asio/example/cpp03/http/server4/header.hpp] -* [@boost_asio/example/cpp03/http/server4/main.cpp] -* [@boost_asio/example/cpp03/http/server4/mime_types.cpp] -* [@boost_asio/example/cpp03/http/server4/mime_types.hpp] -* [@boost_asio/example/cpp03/http/server4/reply.cpp] -* [@boost_asio/example/cpp03/http/server4/reply.hpp] -* [@boost_asio/example/cpp03/http/server4/request.hpp] -* [@boost_asio/example/cpp03/http/server4/request_parser.cpp] -* [@boost_asio/example/cpp03/http/server4/request_parser.hpp] -* [@boost_asio/example/cpp03/http/server4/server.cpp] -* [@boost_asio/example/cpp03/http/server4/server.hpp] - - -[heading ICMP] - -This example shows how to use raw sockets with ICMP to ping a remote host. - -* [@boost_asio/example/cpp03/icmp/ping.cpp] -* [@boost_asio/example/cpp03/icmp/ipv4_header.hpp] -* [@boost_asio/example/cpp03/icmp/icmp_header.hpp] - - -[heading Invocation] - -This example shows how to customise handler invocation. Completion handlers are -added to a priority queue rather than executed immediately. - -* [@boost_asio/example/cpp03/invocation/prioritised_handlers.cpp] - - -[heading Iostreams] - -Two examples showing how to use [link boost_asio.reference.ip__tcp.iostream -ip::tcp::iostream]. - -* [@boost_asio/example/cpp03/iostreams/daytime_client.cpp] -* [@boost_asio/example/cpp03/iostreams/daytime_server.cpp] -* [@boost_asio/example/cpp03/iostreams/http_client.cpp] - - -[heading Multicast] - -An example showing the use of multicast to transmit packets to a group of -subscribers. - -* [@boost_asio/example/cpp03/multicast/receiver.cpp] -* [@boost_asio/example/cpp03/multicast/sender.cpp] - - -[heading Serialization] - -This example shows how Boost.Serialization can be used with asio to encode and -decode structures for transmission over a socket. - -* [@boost_asio/example/cpp03/serialization/client.cpp] -* [@boost_asio/example/cpp03/serialization/connection.hpp] -* [@boost_asio/example/cpp03/serialization/server.cpp] -* [@boost_asio/example/cpp03/serialization/stock.hpp] - - -[heading Services] - -This example demonstrates how to integrate custom functionality (in this case, -for logging) into asio's [link boost_asio.reference.io_context io_context], and -how to use a custom service with [link -boost_asio.reference.basic_stream_socket basic_stream_socket<>]. - -* [@boost_asio/example/cpp03/services/basic_logger.hpp] -* [@boost_asio/example/cpp03/services/daytime_client.cpp] -* [@boost_asio/example/cpp03/services/logger.hpp] -* [@boost_asio/example/cpp03/services/logger_service.cpp] -* [@boost_asio/example/cpp03/services/logger_service.hpp] -* [@boost_asio/example/cpp03/services/stream_socket_service.hpp] - - -[heading SOCKS 4] - -Example client program implementing the SOCKS 4 protocol for communication via -a proxy. - -* [@boost_asio/example/cpp03/socks4/sync_client.cpp] -* [@boost_asio/example/cpp03/socks4/socks4.hpp] - - -[heading SSL] - -Example client and server programs showing the use of the [link -boost_asio.reference.ssl__stream ssl::stream<>] template with asynchronous operations. - -* [@boost_asio/example/cpp03/ssl/client.cpp] -* [@boost_asio/example/cpp03/ssl/server.cpp] - - -[heading Timeouts] - -A collection of examples showing how to cancel long running asynchronous -operations after a period of time. - -* [@boost_asio/example/cpp03/timeouts/async_tcp_client.cpp] -* [@boost_asio/example/cpp03/timeouts/blocking_tcp_client.cpp] -* [@boost_asio/example/cpp03/timeouts/blocking_token_tcp_client.cpp] -* [@boost_asio/example/cpp03/timeouts/blocking_udp_client.cpp] -* [@boost_asio/example/cpp03/timeouts/server.cpp] - - -[heading Timers] - -Example showing how to customise basic_waitable_timer using a different clock type. - -* [@boost_asio/example/cpp03/timers/time_t_timer.cpp] - - -[heading Porthopper] - -Example illustrating mixed synchronous and asynchronous operations, and how to -use Boost.Lambda with Boost.Asio. - -* [@boost_asio/example/cpp03/porthopper/protocol.hpp] -* [@boost_asio/example/cpp03/porthopper/client.cpp] -* [@boost_asio/example/cpp03/porthopper/server.cpp] - - -[heading Nonblocking] - -Example demonstrating reactor-style operations for integrating a third-party -library that wants to perform the I/O operations itself. - -* [@boost_asio/example/cpp03/nonblocking/third_party_lib.cpp] - - -[heading Spawn] - -Example of using the boost::asio::spawn() function, a wrapper around the -[@http://www.boost.org/doc/libs/release/libs/coroutine/index.html Boost.Coroutine] -library, to implement a chain of asynchronous operations using stackful -coroutines. - -* [@boost_asio/example/cpp03/spawn/echo_server.cpp] - - -[heading UNIX Domain Sockets] - -Examples showing how to use UNIX domain (local) sockets. - -* [@boost_asio/example/cpp03/local/connect_pair.cpp] -* [@boost_asio/example/cpp03/local/iostream_client.cpp] -* [@boost_asio/example/cpp03/local/stream_server.cpp] -* [@boost_asio/example/cpp03/local/stream_client.cpp] - - -[heading Windows] - -An example showing how to use the Windows-specific function `TransmitFile` -with Boost.Asio. - -* [@boost_asio/example/cpp03/windows/transmit_file.cpp] - - -[endsect] - - -[section:cpp11_examples C++11 Examples] - - -[heading Allocation] - -This example shows how to customise the allocation of memory associated with -asynchronous operations. - -* [@boost_asio/example/cpp11/allocation/server.cpp] - - -[heading Buffers] - -This example demonstrates how to create reference counted buffers that can be -used with socket read and write operations. - -* [@boost_asio/example/cpp11/buffers/reference_counted.cpp] - - -[heading Chat] - -This example implements a chat server and client. The programs use a custom -protocol with a fixed length message header and variable length message body. - -* [@boost_asio/example/cpp11/chat/chat_message.hpp] -* [@boost_asio/example/cpp11/chat/chat_client.cpp] -* [@boost_asio/example/cpp11/chat/chat_server.cpp] - - -[heading Echo] - -A collection of simple clients and servers, showing the use of both synchronous -and asynchronous operations. - -* [@boost_asio/example/cpp11/echo/async_tcp_echo_server.cpp] -* [@boost_asio/example/cpp11/echo/async_udp_echo_server.cpp] -* [@boost_asio/example/cpp11/echo/blocking_tcp_echo_client.cpp] -* [@boost_asio/example/cpp11/echo/blocking_tcp_echo_server.cpp] -* [@boost_asio/example/cpp11/echo/blocking_udp_echo_client.cpp] -* [@boost_asio/example/cpp11/echo/blocking_udp_echo_server.cpp] - - -[heading Fork] - -These POSIX-specific examples show how to use Boost.Asio in conjunction with the -`fork()` system call. The first example illustrates the steps required to start -a daemon process: - -* [@boost_asio/example/cpp11/fork/daemon.cpp] - -The second example demonstrates how it is possible to fork a process from -within a completion handler. - -* [@boost_asio/example/cpp11/fork/process_per_connection.cpp] - - -[heading Futures] - -This example demonstrates how to use std::future in conjunction with -Boost.Asio's asynchronous operations. - -* [@boost_asio/example/cpp11/futures/daytime_client.cpp] - - -[heading Handler Tracking] - -This example shows how to implement custom handler tracking. - -* [@boost_asio/example/cpp11/handler_tracking/custom_tracking.hpp] - - -[heading HTTP Server] - -This example illustrates the use of asio in a simple single-threaded server -implementation of HTTP 1.0. It demonstrates how to perform a clean shutdown by -cancelling all outstanding asynchronous operations. - -* [@boost_asio/example/cpp11/http/server/connection.cpp] -* [@boost_asio/example/cpp11/http/server/connection.hpp] -* [@boost_asio/example/cpp11/http/server/connection_manager.cpp] -* [@boost_asio/example/cpp11/http/server/connection_manager.hpp] -* [@boost_asio/example/cpp11/http/server/header.hpp] -* [@boost_asio/example/cpp11/http/server/main.cpp] -* [@boost_asio/example/cpp11/http/server/mime_types.cpp] -* [@boost_asio/example/cpp11/http/server/mime_types.hpp] -* [@boost_asio/example/cpp11/http/server/reply.cpp] -* [@boost_asio/example/cpp11/http/server/reply.hpp] -* [@boost_asio/example/cpp11/http/server/request.hpp] -* [@boost_asio/example/cpp11/http/server/request_handler.cpp] -* [@boost_asio/example/cpp11/http/server/request_handler.hpp] -* [@boost_asio/example/cpp11/http/server/request_parser.cpp] -* [@boost_asio/example/cpp11/http/server/request_parser.hpp] -* [@boost_asio/example/cpp11/http/server/server.cpp] -* [@boost_asio/example/cpp11/http/server/server.hpp] - - -[heading Multicast] - -An example showing the use of multicast to transmit packets to a group of -subscribers. - -* [@boost_asio/example/cpp11/multicast/receiver.cpp] -* [@boost_asio/example/cpp11/multicast/sender.cpp] - - -[heading Nonblocking] - -Example demonstrating reactor-style operations for integrating a third-party -library that wants to perform the I/O operations itself. - -* [@boost_asio/example/cpp11/nonblocking/third_party_lib.cpp] - - -[heading Spawn] - -Example of using the boost::asio::spawn() function, a wrapper around the -[@http://www.boost.org/doc/libs/release/libs/coroutine/index.html Boost.Coroutine] -library, to implement a chain of asynchronous operations using stackful -coroutines. - -* [@boost_asio/example/cpp11/spawn/echo_server.cpp] - - -[heading UNIX Domain Sockets] - -Examples showing how to use UNIX domain (local) sockets. - -* [@boost_asio/example/cpp11/local/connect_pair.cpp] -* [@boost_asio/example/cpp11/local/iostream_client.cpp] -* [@boost_asio/example/cpp11/local/stream_server.cpp] -* [@boost_asio/example/cpp11/local/stream_client.cpp] - - -[endsect] - - -[section:cpp17_examples C++17 Examples] - - -[heading Coroutines TS Support] - -Examples showing how to implement a chain of asynchronous operations using the -Coroutines TS. - -* [@boost_asio/example/cpp17/coroutines_ts/echo_server.cpp] -* [@boost_asio/example/cpp17/coroutines_ts/refactored_echo_server.cpp] -* [@boost_asio/example/cpp17/coroutines_ts/double_buffered_echo_server.cpp] -* [@boost_asio/example/cpp17/coroutines_ts/chat_server.cpp] -* [@boost_asio/example/cpp17/coroutines_ts/range_based_for.cpp] - - -[endsect] - - -[endsect] diff --git a/boost-asio/doc/history.qbk b/boost-asio/doc/history.qbk deleted file mode 100644 index 93b627a7f..000000000 --- a/boost-asio/doc/history.qbk +++ /dev/null @@ -1,982 +0,0 @@ -[/ - / Copyright (c) 2003-2018 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:history Revision History] - -[heading Asio 1.12.1 / Boost 1.67] - -* Added missing const qualifier to `basic_socket_acceptor::get_option`. -* Worked around a parsing error that occurs with some versions of gcc. -* Fixed broken code samples in tutorial. -* Added new experimental features. (Note that "experimental" features may be - changed without notice in subsequent releases.) - * Added `experimental::detached` completion token. - * Added `experimental::redirect_error` completion token. - * Added `experimental::co_spawn` facility for integration with the coroutines - technical specification. -* Updated timeout examples to use latest features. - * Used `asio::steady_timer` rather than `asio::deadline_timer`. - * Used `asio::dynamic_buffer` rather than `asio::streambuf`. - * Used timed `asio::io_context::run_for()` function for blocking clients. - * Added example showing a custom completion token for blocking with timeouts. -* Fixed unit tests to compile when `BOOST_ASIO_NO_DEPRECATED` is defined. -* Changed socket iostreams to use chrono by default, to fix compatibility with - the Networking TS. Define `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`. -* Updated examples to use chrono rather than Boost.Date_Time. -* Fixed an incorrect member function detector in the `is_dynamic_buffer` trait. -* Fixed an `async_result` incompatibility with deprecated `handler_type`. -* Added a missing move optimisation in the SSL stream implementation. -* Fixed incorrect `basic_resolver_results::value_type` typedef. -* Fixed a compile error with some OpenSSL versions when `SSL_OP_NO_COMPRESSION` - is defined. -* Changed `add_certificate_authority` to process multiple certificates in a bundle. -* Eliminated deprecation warning with MSVC by using `std::invoke_result` rather - than `std::result_of`. -* Changed to use `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. -* Ensured `DynamicBuffer` template arguments are decayed before using in - `enable_if` tests. -* Changed documentation to distinguish legacy completion handlers (which are - still required to be CopyConstructible) from new MoveConstructible handlers. -* Suppressed a discarded return value warning in the buffer debugging support. -* Fixed `basic_yield_context` to work with completion signatures containing - reference parameters. -* Ensured that stackful coroutines launched using `spawn()` correctly store - decayed copies of their function and handler arguments. -* Fixed some compatibility issues with Android. -* Added cross-compilation support to Jamfiles. -* Fixed some minor portability issues in examples. - -[heading Asio 1.12.0 / Boost 1.66] - -* Implemented interface changes to reflect the Networking TS - ([@www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/n4656.pdf N4656]). - * See the [link boost_asio.net_ts list] of new interfaces and, where - applicable, the corresponding old interfaces that have been superseded. - * The service template parameters, and the corresponding classes, are disabled - by default. For example, instead of `basic_socket` we - now have simply `basic_socket`. The old interface can be enabled by - defining the `BOOST_ASIO_ENABLE_OLD_SERVICES` macro. -* Removed previously deprecated functions. -* Added support for customised handler tracking. -* Added reactor-related (i.e. descriptor readiness) events to handler tracking. -* Added special [link boost_asio.overview.core.concurrency_hint concurrency - hint] values that may be used to disable locking on a per `io_context` basis. -* Enabled perfect forwarding for the first `ssl::stream<>` constructor argument. -* Added ability to release ownership of the underlying native socket. (Requires - Windows 8.1 or later when using the I/O completion port backend.) - -[heading Asio 1.10.10 / Boost 1.65] - -* Changed to require [^g++] versions >= 4.7 to use standard atomics, to fix - a linker error when using [^g++] 4.6 ([ticket 13121]). -* Enabled use of `constexpr` and variadic templates with recent MSVC versions. -* Fixed a race condition in the Linux epoll backend, which may occur when a - socket or descriptor is closed while another thread is blocked on epoll. -* Eliminated use of deprecated `auto_ptr`. -* Fixed misplaced use of `asio_handler_is_continuation` result in reactive - `async_accept` implementation. -* Changed to use `poll.h` rather than `sys/poll.h` on some modern POSIX - platforms ([ticket 12419]). -* Fixed MSVC intellisense detection. -* Disabled use of the `__thread` keyword extension for android/clang/x86 - targets. - -[heading Asio 1.10.9 / Boost 1.64] - -* Added limited support for using regular file descriptors (where I/O - operations should never fail with `EAGAIN` or `EWOULDBLOCK`) with - `posix::stream_descriptor`, when using the Linux epoll backend. -* Changed to use `allocator_traits` to rebind allocators in C++11 or later. -* Eliminated a double "construction" issue in the converting move constructors. -* Added new `ssl::context_base` enumerations to enable support for any TLS - version, and improved consistency of SSL/TLS version handling across OpenSSL - releases. -* Applied more changes to address OpenSSL 1.1 compatibility. -* Fixed a compile error when OpenSSL compression is disabled at compile time. -* Suppressed some spurious unused variable warnings issued by [^gcc] ([ticket - 12302]). -* Worked around a new clang warning issued for usage of the comma operator. -* Fixed various header ordering problems. -* Changed to refer `std::atomic_thread_fence`, when available, to eliminate a - deprecated function warning on newest macOS SDK ([ticket 12482]). -* Added a workaround for broken `getaddrinfo` in Apple's NAT64 environment. -* Fixed an exception safety issue in the internal hash map implementation. - -[heading Asio 1.10.8 / Boost 1.62] - -* Added compatibility with OpenSSL 1.1.0 ([ticket 12238]). -* Fixed out-of-bounds iterator use in `asio::connect()` when the - `connect_condition` returns an end iterator ([ticket 12354]). -* Added a workaround for a move detection problem on MSVC 2015 Update 2 - ([ticket 12115]). -* Changed a workaround that was previously added for broken Windows firewalls - to only bind to 127.0.0.1 if `getsockname` reports 0.0.0.0 ([ticket - 12406]). -* Added call to `SSL_COMP_free_compression_methods` to fix two memory leaks - reported at shutdown, for OpenSSL versions >= 1.0.2 and < 1.1.0 ([ticket - 10795]). -* Fixed `use_future` compile error encountered on some standard library - implementations, by changing `std::allocator` use to a non-void - template parameter. -* Enabled use of native `getaddrinfo` by default on Apple OSes, rather than - emulation in terms of `getipnodebyname`. - -[heading Asio 1.10.7 / Boost 1.60] - -* Added support for Windows 8.1 Store apps. -* Fixed macro multiple definition error on Microsoft Visual Studio 2015 - ([ticket 11539]). -* Changed Asio's SSL wrapper to respect OpenSSL's `OPENSSL_NO_SSL3` feature - test `#define` ([ticket 11754]). -* Changed Asio's SSL wrapper to use OpenSSL's new `SSL_CTX_clear_chain_certs` - function, if available. -* Suppressed a clang 3.6+ warning about unused typedefs ([ticket 11767]). -* Regenerated certificates used by SSL examples. -* Fixed buffer sizes passed to `strncat` in the `getaddrinfo` emulation and in - the SSL wrapper's password handling. -* Changed Windows backend to use non-macro `CreateEventW` rather than - `CreateEvent` ([ticket 11732]). - -[heading Asio 1.10.6 / Boost 1.58] - -* Ensured errors generated by Windows' `ConnectEx` function are mapped to their - portable equivalents ([ticket 10744]). -* Added new macro `BOOST_ASIO_DISABLE_CONNECTEX` to allow use of `ConnectEx` to - be explicitly disabled. -* Fixed a race condition in `windows::object_handle` when there are pending - wait operations on destruction ([ticket 10624]). -* Fixed IPv6 address parsing on FreeBSD, where a trailing scope ID would cause - conversion to fail with `EINVAL`. -* Worked around shared library visibility issues by ensuring Asio types use - default visibility ([ticket 9465], [ticket 11070]). -* Changed the SSL wrapper to call the password callback when loading an - in-memory key ([ticket 10828]). -* Fixed false SSL error reports by ensuring that the SSL error queue is cleared - prior to each operation. -* Fixed an `ssl::stream<>` bug that may result in spurious 'short read' errors. -* Removed a redundant null pointer check in the SSL engine ([ticket 10088]). -* Added options for disabling TLS v1.1 and v1.2 ([ticket 10690]). -* Removed use of deprecated OpenSSL function `ERR_remove_state`. -* Fixed detection of various C++11 features with Clang ([ticket 8835], - [ticket 10884]). -* Fixed detection of C++11 `std::addressof` with [^g++] ([ticket 10982]). -* Changed multicast test to treat certain `join_group` failures as non-fatal. -* Decoupled Asio unit tests from Boost.Test ([ticket 11116]). -* Changed the tutorial to use `std::endl` to ensure output is flushed. -* Fixed an unsigned integer overflow reported by Clang's integer sanitizer. -* Added support for move-only return types when using a `yield_context` object - with asynchronous operations. -* Changed `yield_context` to allow reentrant calls to the completion handler - from an initiating function. -* Updated detection of Windows Runtime to work with latest Windows SDK. - -[heading Asio 1.10.5 / Boost 1.57] - -* Fixed the [^kqueue] reactor so that it works on FreeBSD ([ticket 10606]). -* Fixed an issue in the [^kqueue] reactor which resulted in spinning when using - serial ports on Mac OS ([ticket 10496]). -* Fixed [^kqueue] reactor support for read-only file descriptors - ([ticket 10367]). -* Fixed a compile error when using the [^/dev/poll] reactor ([ticket 10350], - [ticket 10572]). -* Changed the Windows backend to use `WSASocketW`, as `WSASocketA` has been - deprecated ([ticket 10534]). -* Fixed some warnings reported by Visual C++ 2013 ([ticket 10376]). -* Fixed integer type used in the WinRT version of the byte-order conversion - functions ([ticket 10539]). -* Changed documentation to indicate that `use_future` and `spawn()` are not - made available when including the `asio.hpp` convenience header ([ticket - 10567]). -* Explicitly marked `asio::strand` as deprecated. Use - `asio::io_service::strand` instead. - -[heading Asio 1.10.4 / Boost 1.56] - -* Stopped using certain Winsock functions that are marked as deprecated in the - latest Visual C++ and Windows SDK. -* Fixed a shadow variable warning on Windows. -* Fixed a regression in the [^kqueue] backend that was introduced in Asio - 1.10.2. -* Added a workaround for building the unit tests with [^gcc] on AIX. - -[heading Asio 1.10.3] - -* Worked around a [^gcc] problem to do with anonymous enums ([ticket 10042]). -* Reverted the Windows `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 ([ticket 10034]). -* Fixed an off-by-one error in the `signal_set` implementation's signal - number check ([ticket 9324]). -* Changed the Windows IOCP backend to not assume that - `SO_UPDATE_CONNECT_CONTEXT` is defined ([ticket 10016]). -* Fixed a Windows-specific issue, introduced in Asio 1.10.2, by using - `VerifyVersionInfo` rather than `GetVersionEx`, as `GetVersionEx` has been - deprecated. -* Changed to use SSE2 intrinsics rather than inline assembly, to allow the - Cray compiler to work. - -[heading Asio 1.10.2] - -* Fixed `asio::spawn()` to work correctly with new Boost.Coroutine interface - ([ticket 9442], [ticket 9928]). -* Ensured that incomplete `asio::spawn()` coroutines are correctly unwound when - cleaned up by the `io_service` destructor ([ticket 9731]). -* Fixed delegation of continuation hook for handlers produced by - `io_service::wrap()` and `strand::wrap()` ([ticket 9741]). -* Changed the Windows I/O completion port backend to use `ConnectEx`, if - available, for connection-oriented IP sockets. -* Changed the `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. -* Prevented integer overflow when computing timeouts based on some - `boost::chrono` and `std::chrono` clocks ([ticket 9662], [ticket 9778]). -* Made further changes to `EV_CLEAR` handling in the kqueue backend, to address - other cases where the `close()` system call may hang on Mac OS X. -* Fixed infinite recursion in implementation of - `resolver_query_base::flags::operator~` ([ticket 9548]). -* Made the `select` reactor more efficient on Windows for large numbers of - sockets ([ticket 9528]). -* Fixed a Windows-specific type-aliasing issue reported by [^gcc] ([ticket - 9550]). -* Prevented execution of compile-time-only buffer test to avoid triggering an - address sanitiser warning ([ticket 8295]). -* Disabled the `GetQueuedCompletionStatus` timeout workaround on recent - versions of Windows. -* Added support for string-based scope IDs when using link-local multicast - addresses. -* Changed IPv6 multicast group join to use the address's scope ID as the - interface, if an interface is not explicitly specified. -* Fixed multicast test failure on Mac OS X and the BSDs by using a link-local - multicast address. -* Various minor documentation improvements ([ticket 8295], [ticket 9605], - [ticket 9771]). - -[heading Asio 1.10.1 / Boost 1.55] - -* Implemented a limited port to Windows Runtime. This support requires that the - language extensions be enabled. Due to the restricted facilities exposed by - the Windows Runtime API, the port also comes with the following caveats: - * The core facilities such as the `io_service`, `strand`, buffers, composed - operations, timers, etc., should all work as normal. - * For sockets, only client-side TCP is supported. - * Explicit binding of a client-side TCP socket is not supported. - * The `cancel()` function is not supported for sockets. Asynchronous - operations may only be cancelled by closing the socket. - * Operations that use `null_buffers` are not supported. - * Only `tcp::no_delay` and `socket_base::keep_alive` options are supported. - * Resolvers do not support service names, only numbers. I.e. you must - use "80" rather than "http". - * Most resolver query flags have no effect. -* Fixed a regression (introduced in Boost 1.54) where, on some platforms, errors - from `async_connect` were not correctly propagated through to the completion - handler ([ticket 8795]). -* Fixed a Windows-specific regression (introduced in Boost 1.54) that occurs - when multiple threads are running an `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 ([ticket 8933]). -* Fixed a bug in handler tracking, where it was not correctly printing out some - handler IDs ([ticket 8808]). -* Fixed the comparison used to test for successful synchronous accept - operations so that it works correctly with unsigned socket descriptors - ([ticket 8752]). -* Ensured the signal number is correctly passed to the completion handler when - starting an `async_wait` on a signal that is already raised ([ticket 8738]). -* Suppressed a g++ 4.8+ warning about unused typedefs ([ticket 8980]). -* Enabled the move optimisation for handlers that use the default invocation - hook ([ticket 8624]). -* Clarified that programs must not issue overlapping `async_write_at` - operations ([ticket 8669]). -* Changed the Windows `HANDLE` backend to treat `ERROR_MORE_DATA` as a - non-fatal error when returned by `GetOverlappedResult` for a synchronous - read ([ticket 8722]). -* Visual C++ language extensions use `generic` as a keyword. Added a - workaround that renames the namespace to `cpp_generic` when those language - extensions are in effect. -* Fixed some asynchronous operations that missed out on getting `async_result` - support in Boost 1.54. In particular, the buffered stream templates have been - updated so that they adhere to current handler patterns ([ticket 9000], - [ticket 9001]). -* Enabled move support for Microsoft Visual Studio 2012 ([ticket 8959]). -* Added `use_future` support for Microsoft Visual Studio 2012. -* Removed a use of `std::min` in the Windows IOCP backend to avoid a - dependency on the `` header ([ticket 8758]). -* Eliminated some unnecessary handler copies. -* Fixed support for older versions of OpenSSL that do not provide the - `SSL_CTX_clear_options` function ([ticket 9273]). -* Fixed various minor and cosmetic issues in code and documentation - (including [ticket 8347], [ticket 8950], [ticket 8953], [ticket 8965], - [ticket 8997], [ticket 9230]). - -[heading Asio 1.10.0 / Boost 1.54] - -* Added new traits classes, `handler_type` and `async_result`, that allow the - customisation of the return type of an initiating function. -* Added the `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 [link boost_asio.overview.core.spawn Stackful - Coroutines]. -* Added the `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 = my_socket.async_read_some(my_buffer, asio::use_future);`. - For further information, see [link boost_asio.overview.cpp2011.futures C++ - 2011 Support - Futures]. -* Promoted the stackless coroutine class and macros to be part of Asio's - documented interface, rather than part of the HTTP server 4 example. - For further information, see [link boost_asio.overview.core.coroutine - Stackless Coroutines]. -* Added a new handler hook called `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. -* Added four new generic protocol classes, `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 [link - boost_asio.overview.networking.other_protocols Support for Other Protocols]. -* Added C++11 move constructors that allow the conversion of a socket (or - acceptor) into a more generic type. For example, an `ip::tcp::socket` can - be converted into a `generic::stream_protocol::socket` via move - construction. - For further information, see [link - boost_asio.overview.networking.other_protocols Support for Other Protocols]. -* Extended the `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 [link - boost_asio.overview.networking.other_protocols Support for Other Protocols]. -* Moved existing examples into a C++03-specific directory, and added a new - directory for C++11-specific examples. A limited subset of the C++03 - examples have been converted to their C++11 equivalents. -* Various SSL enhancements. Thanks go to Nick Jones, on whose work these changes - are based. - * Added support for SSL handshakes with re-use of data already read from - the wire. New overloads of the `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. - * Added support for creation of TLSv1.1 and TLSv1.2 `ssl::context` objects. - * Added a `set_verify_depth()` function to the `ssl::context` and - `ssl::stream<>` classes. - * Added the ability to load SSL certificate and key data from memory - buffers. New functions, `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. - * Changed `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)`. -* Fixed a potential deadlock in `signal_set` implementation. -* Fixed an error in acceptor example in documentation [ticket 8421]. -* Fixed copy-paste errors in waitable timer documentation [ticket 8602]. -* Added assertions to satisfy some code analysis tools [ticket 7739]. -* Fixed a malformed `#warning` directive [ticket 7939]. -* Fixed a potential data race in the Linux `epoll` implementation. -* Fixed a Windows-specific bug, where certain operations might generate an - `error_code` with an invalid (i.e. `NULL`) `error_category` [ticket 8613]. -* Fixed `basic_waitable_timer`'s underlying implementation so that it can - handle any `time_point` value without overflowing the intermediate duration - objects. -* Fixed a problem with lost thread wakeups that can occur when making - concurrent calls to `run()` and `poll()` on the same `io_service` object - [ticket 8354]. -* Fixed implementation of asynchronous connect operation so that it can cope - with spurious readiness notifications from the reactor [ticket 7961]. -* Fixed a memory leak in the `ssl::rfc2818_verification` class. -* Added a mechanism for disabling automatic Winsock initialisation [ticket - 3605]. See the header file [^boost/asio/detail/winsock_init.hpp] for details. - -[heading Asio 1.8.3 / Boost 1.53] - -* Fixed some 64-to-32-bit conversion warnings ([ticket 7459]). -* Fixed some small errors in documentation and comments ([ticket 7761]). -* Fixed an error in the example embedded in `basic_socket::get_option`'s - documentation ([ticket 7562]). -* Changed to use `long` rather than `int` for SSL_CTX options, to match OpenSSL - ([ticket 7209]). -* Changed to use `_snwprintf` to address a compile error due to the changed - `swprintf` signature in recent versions of MinGW ([ticket 7373]). -* Fixed a deadlock that can occur on Windows when shutting down a pool of - `io_service` threads due to running out of work ([ticket 7552]). -* Enabled the `noexcept` qualifier for error categories ([ticket 7797]). -* Changed UNIX domain socket example to treat errors from `accept` as non-fatal - ([ticket 7488]). -* Added a small block recycling optimisation to improve default memory - allocation behaviour. - -[heading Asio 1.8.2 / Boost 1.51] - -* Fixed an incompatibility between `ip::tcp::iostream` and C++11 - ([@https://svn.boost.org/trac/boost/ticket/7162 #7162]). -* Decorated GCC attribute names with underscores to prevent interaction - with user-defined macros - ([@https://svn.boost.org/trac/boost/ticket/6415 #6415]). -* Added missing `#include `, needed for some versions of MinGW. -* Changed to use [^gcc]'s atomic builtins on ARM CPUs, when available - ([@https://svn.boost.org/trac/boost/ticket/7140 #7140]). -* Changed strand destruction to be a no-op, to allow strand objects to be - destroyed after their associated `io_service` has been destroyed. -* Added support for some newer versions of glibc which provide the - `epoll_create1()` function but always fail with `ENOSYS` - ([@https://svn.boost.org/trac/boost/ticket/7012 #7012]). -* Changed the SSL implementation to throw an exception if SSL engine - initialisation fails - ([@https://svn.boost.org/trac/boost/ticket/6303 #6303]). -* Fixed another regression in `buffered_write_stream` - ([@https://svn.boost.org/trac/boost/ticket/6310 #6310]). -* Implemented various minor performance improvements, primarily targeted at - Linux x86 and x86-64 platforms. - -[heading Asio 1.8.1 / Boost 1.50] - -* Changed the `epoll_reactor` backend to do lazy registration for `EPOLLOUT` - events. -* Fixed the `epoll_reactor` handling of out-of-band data, which was broken by - an incomplete fix in the last release. -* Changed Asio's SSL wrapper to respect OpenSSL's `OPENSSL_NO_ENGINE` feature - test `#define` ([@https://svn.boost.org/trac/boost/ticket/6432 #6432]). -* Fixed `windows::object_handle` so that it works with Windows compilers that - support C++11 move semantics (such as [^g++]). -* Improved the performance of strand rescheduling. -* Added support for [^g++] 4.7 when compiling in C++11 mode - ([@https://svn.boost.org/trac/boost/ticket/6620 #6620]). -* Fixed a problem where `signal_set` handlers were not being delivered when - the `io_service` was constructed with a `concurrency_hint` of 1 - ([@https://svn.boost.org/trac/boost/ticket/6657 #6657]). - -[heading Asio 1.8.0 / Boost 1.49] - -* Added a new class template `basic_waitable_timer` based around the C++11 clock - type requirements. It may be used with the clocks from the C++11 `` - 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. -* Added a new `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. -* On Linux, `connect()` can return EAGAIN in certain circumstances. Remapped - this to another error so that it doesn't look like a non-blocking operation - ([@https://svn.boost.org/trac/boost/ticket/6048 #6048]). -* Fixed a compile error on NetBSD - ([@https://svn.boost.org/trac/boost/ticket/6098 #6098]). -* Fixed deadlock on Mac OS X - ([@https://svn.boost.org/trac/boost/ticket/6275 #6275]). -* Fixed a regression in `buffered_write_stream` - ([@https://svn.boost.org/trac/boost/ticket/6310 #6310]). -* Fixed a non-paged pool "leak" on Windows when an `io_service` is repeatedly - run without anything to do - ([@https://svn.boost.org/trac/boost/ticket/6321 #6321]). -* Reverted earlier change to allow some speculative operations to be performed - without holding the lock, as it introduced a race condition in some - multithreaded scenarios. -* Fixed a bug where the second buffer in an array of two buffers may be ignored - if the first buffer is empty. - -[heading Asio 1.6.1 / Boost 1.48] - -* Implemented various performance improvements, including: - * Using thread-local operation queues in single-threaded use cases (i.e. when - `concurrency_hint` is 1) to eliminate a lock/unlock pair. - * Allowing some `epoll_reactor` speculative operations to be performed - without holding the lock. - * Improving locality of reference by performing an `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`. - * Specialising asynchronous read and write operations for buffer sequences - that are arrays (`boost::array` or `std::array`) of exactly two buffers. -* Fixed a compile error in the regex overload of `async_read_until` - ([@https://svn.boost.org/trac/boost/ticket/5688 #5688]). -* Fixed a Windows-specific compile error by explicitly specifying the - `signal()` function from the global namespace - ([@https://svn.boost.org/trac/boost/ticket/5722 #5722]). -* Changed the `deadline_timer` implementation so that it does not read the - clock unless the timer heap is non-empty. -* Changed the SSL stream's buffers' sizes so that they are large enough to hold - a complete TLS record ([@https://svn.boost.org/trac/boost/ticket/5854 #5854]). -* Fixed the behaviour of the synchronous `null_buffers` operations so that they - obey the user's non-blocking setting - ([@https://svn.boost.org/trac/boost/ticket/5756 #5756]). -* Changed to set the size of the select `fd_set` at runtime when using Windows. -* Disabled an MSVC warning due to const qualifier being applied to function type. -* Fixed a crash that occurs when using the Intel C++ compiler - ([@https://svn.boost.org/trac/boost/ticket/5763 #5763]). -* Changed the initialisation of the OpenSSL library so that it supports all - available algorithms. -* Fixed the SSL error mapping used when the session is gracefully shut down. -* Added some latency test programs. -* Clarified that a read operation ends when the buffer is full - ([@https://svn.boost.org/trac/boost/ticket/5999 #5999]). -* Fixed an exception safety issue in `epoll_reactor` initialisation - ([@https://svn.boost.org/trac/boost/ticket/6006 #6006]). -* Made the number of strand implementations configurable by defining - `BOOST_ASIO_STRAND_IMPLEMENTATIONS` to the desired number. -* Added support for a new `BOOST_ASIO_ENABLE_SEQUENTIAL_STRAND_ALLOCATION` flag - which switches the allocation of strand implementations to use a round-robin - approach rather than hashing. -* Fixed potential strand starvation issue that can occur when `strand.post()` - is used. - -[heading Asio 1.6.0 / Boost 1.47] - -* Added support for signal handling, using a new class called `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 [@https://svn.boost.org/trac/boost/ticket/2879 #2879]. -* Added handler tracking, a new debugging aid. When enabled by defining - `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). -* Added support for timeouts on socket iostreams, such as `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. -* Added a new `error()` member function to socket iostreams, for retrieving the - error code from the most recent system call. -* Added a new `basic_deadline_timer::cancel_one()` function. This function lets - you cancel a single waiting handler on a timer. Handlers are cancelled in - FIFO order. -* Added a new `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. -* Added new free functions `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. -* Extended the `buffer_size()` function so that it works for buffer sequences - in addition to individual buffers. -* Added a new `buffer_copy()` function that can be used to copy the raw bytes - between individual buffers and buffer sequences. -* Added new non-throwing overloads of `read()`, `read_at()`, `write()` and - `write_at()` that do not require a completion condition. -* Added friendlier compiler errors for when a completion handler does not meet - the necessary type requirements. When C++0x is available (currently supported - for [^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`. -* Added a new, completely rewritten SSL implementation. The new implementation - compiles faster, shows substantially improved performance, and supports - custom memory allocation and handler invocation. It includes new API features - such as certificate verification callbacks and has improved error reporting. - The new implementation is source-compatible with the old for most uses. - However, if necessary, the old implementation may still be used by defining - `BOOST_ASIO_ENABLE_OLD_SSL`. - Addresses [@https://svn.boost.org/trac/boost/ticket/3702 #3702], - [@https://svn.boost.org/trac/boost/ticket/3958 #3958]. -* Changed the separate compilation support such that, to use Asio's SSL - capabilities, you should also include `boost/asio/ssl/impl/src.hpp` in one - source file in your program. -* Changed the SSL implementation to support build environments where SSL v2 is - explicitly disabled ([@https://svn.boost.org/trac/boost/ticket/5453 #5453]). -* Made the `is_loopback()`, `is_unspecified()` and `is_multicast()` functions - consistently available across the `ip::address`, `ip::address_v4` and - `ip::address_v6` classes - ([@https://svn.boost.org/trac/boost/ticket/3939 #3939]). -* Added new `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. -* Added new `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. -* Added the `io_control()` member function for socket acceptors - ([@https://svn.boost.org/trac/boost/ticket/3297 #3297]). -* Added a `release()` member function to posix descriptors. This function - releases ownership of the underlying native descriptor to the caller. - Addresses [@https://svn.boost.org/trac/boost/ticket/3900 #3900]. -* Added support for sequenced packet sockets (`SOCK_SEQPACKET`). -* Added a new `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()`). -* For consistency with the C++0x standard library, deprecated the `native_type` - typedefs in favour of `native_handle_type`, and the `native()` member - functions in favour of `native_handle()`. -* Added support for C++0x move construction and assignment to sockets, serial - ports, POSIX descriptors and Windows handles. -* Reduced the copying of handler function objects. -* Added support for C++0x move construction to further reduce (and in some - cases eliminate) copying of handler objects. -* Added support for the `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 - [@https://svn.boost.org/trac/boost/ticket/3238 #3238], - [@https://svn.boost.org/trac/boost/ticket/4162 #4162]. -* Cleaned up the handling of errors reported by the `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 - [@https://svn.boost.org/trac/boost/ticket/3307 #3307]. -* Added new `asio::buffer()` overloads for `std::array`, when available. -* Changed the implementation to use the C++0x standard library templates - `array`, `shared_ptr`, `weak_ptr` and `atomic` when they are available, - rather than the Boost equivalents. -* Use C++0x variadic templates when available, rather than generating function - overloads using Boost.Preprocessor. -* Changed exception reporting to include the function name in exception `what()` - messages. -* Fixed insufficient initialisers warning with MinGW. -* Changed the `shutdown_service()` member functions to be private. -* Added archetypes for testing socket option functions. -* Changed the Boost.Asio examples so that they don't use Boost.Thread's - convenience header. Use the header file that is specifically for the - boost::thread class instead. -* Removed the dependency on OS-provided macros for the well-known IPv4 and IPv6 - addresses. This should eliminate annoying "missing braces around initializer" - warnings ([@https://svn.boost.org/trac/boost/ticket/3741 #3741]). -* Reduced the size of `ip::basic_endpoint<>` objects (such as - `ip::tcp::endpoint` and `ip::udp::endpoint`). -* Changed the reactor backends to assume that any descriptors or sockets added - using `assign()` may have been `dup()`-ed, and so require explicit - deregistration from the reactor - ([@https://svn.boost.org/trac/boost/ticket/4971 #4971]). -* Removed the deprecated member functions named `io_service()`. The - `get_io_service()` member functions should be used instead. -* Removed the deprecated typedefs `resolver_query` and `resolver_iterator` from - the `ip::tcp`, `ip::udp` and `ip::icmp` classes. -* Modified the `buffers_iterator<>` and `ip::basic_resolver_iterator` classes - so that the value_type typedefs are non-const byte types. -* Fixed warnings reported by g++'s [^-Wshadow] compiler option - ([@https://svn.boost.org/trac/boost/ticket/3905 #3905]). -* Added an explicit cast to convert the `FIONBIO` constant to int, to suppress - a compiler warning on some platforms - ([@https://svn.boost.org/trac/boost/ticket/5128 #5128]). -* Changed most examples to treat a failure by an accept operation as non-fatal - ([@https://svn.boost.org/trac/boost/ticket/5124 #5124]). -* Fixed an error in the [^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 ([@https://svn.boost.org/trac/boost/ticket/5418 #5418]). - -[heading Asio 1.4.9 / Boost 1.46.1] - -* `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 - ([@https://svn.boost.org/trac/boost/ticket/5021 #5021]). -* Fixed compile failures with some versions of [^g++] due to the use of - anonymous enums ([@https://svn.boost.org/trac/boost/ticket/4883 #4883]). -* Fixed a bug on kqueue-based platforms, where some system calls that - repeatedly fail with `EWOULDBLOCK` are not correctly re-registered with - kqueue. -* Changed `asio::streambuf` to ensure that its internal pointers are updated - correctly after the data has been modified using `std::streambuf` member - functions. -* Fixed a bug that prevented the linger socket option from working on platforms - other than Windows. - -[heading Asio 1.4.8 / Boost 1.46] - -* Fixed an integer overflow problem that occurs when - `ip::address_v4::broadcast()` is used on 64-bit platforms. -* Fixed a problem on older Linux kernels (where epoll is used without timerfd - support) that prevents timely delivery of deadline_timer handlers, after the - program has been running for some time - ([@https://svn.boost.org/trac/boost/ticket/5045 #5045]). - -[heading Asio 1.4.7 / Boost 1.45] - -* Fixed a problem on kqueue-based platforms where a `deadline_timer` may - never fire if the `io_service` is running in a background thread - ([@https://svn.boost.org/trac/boost/ticket/4568 #4568]). -* Fixed a const-correctness issue that prevented valid uses of - `has_service<>` from compiling - ([@https://svn.boost.org/trac/boost/ticket/4638 #4638]). -* Fixed MinGW cross-compilation - ([@https://svn.boost.org/trac/boost/ticket/4491 #4491]). -* Removed dependency on deprecated Boost.System functions - ([@https://svn.boost.org/trac/boost/ticket/4672 #4672]). -* Ensured `close()`\/`closesocket()` failures are correctly propagated - ([@https://svn.boost.org/trac/boost/ticket/4573 #4573]). -* Added a check for errors returned by `InitializeCriticalSectionAndSpinCount` - ([@https://svn.boost.org/trac/boost/ticket/4574 #4574]). -* Added support for hardware flow control on QNX - ([@https://svn.boost.org/trac/boost/ticket/4625 #4625]). -* Always use `pselect()` on HP-UX, if it is available - ([@https://svn.boost.org/trac/boost/ticket/4578 #4578]). -* Ensured handler arguments are passed as lvalues - ([@https://svn.boost.org/trac/boost/ticket/4744 #4744]). -* Fixed Windows build when thread support is disabled - ([@https://svn.boost.org/trac/boost/ticket/4680 #4680]). -* Fixed a Windows-specific problem where `deadline_timer` objects with expiry - times set more than 5 minutes in the future may never expire - ([@https://svn.boost.org/trac/boost/ticket/4745 #4745]). -* Fixed the `resolver` backend on BSD platforms so that an empty service name - resolves to port number `0`, as per the documentation - ([@https://svn.boost.org/trac/boost/ticket/4690 #4690]). -* Fixed read operations so that they do not accept buffer sequences of type - `const_buffers_1` ([@https://svn.boost.org/trac/boost/ticket/4746 #4746]). -* Redefined `Protocol` and `id` to avoid clashing with Objective-C++ keywords - ([@https://svn.boost.org/trac/boost/ticket/4191 #4191]). -* Fixed a `vector` reallocation performance issue that can occur when there are - many active `deadline_timer` objects - ([@https://svn.boost.org/trac/boost/ticket/4780 #4780]). -* Fixed the kqueue backend so that it compiles on NetBSD - ([@https://svn.boost.org/trac/boost/ticket/4662 #4662]). -* Fixed the socket `io_control()` implementation on 64-bit Mac OS X and BSD - platforms ([@https://svn.boost.org/trac/boost/ticket/4782 #4782]). -* Fixed a Windows-specific problem where failures from `accept()` are - incorrectly treated as successes - ([@https://svn.boost.org/trac/boost/ticket/4859 #4859]). -* Deprecated the separate compilation header `` in - favour of `` - ([@https://svn.boost.org/trac/boost/ticket/4560 #4560]). - -[heading Asio 1.4.6 / Boost 1.44] - -* Reduced compile times. (Note that some programs may need to add additional - `#include`s, e.g. if the program uses `boost::array` but does not explicitly - include ``.) -* Reduced the size of generated code. -* Refactored `deadline_timer` implementation to improve performance. -* Improved multiprocessor scalability on Windows by using a dedicated hidden - thread to wait for timers. -* Improved performance of `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. -* Added optional separate compilation. To enable, add - `#include ` 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. -* Added new macro `BOOST_ASIO_DISABLE_FENCED_BLOCK` to permit the disabling of - memory fences around completion handlers, even if thread support is enabled. -* Reworked timeout examples to better illustrate typical use cases. -* Ensured that handler arguments are passed as `const` types. -* Fixed incorrect parameter order in `null_buffers` variant of `async_send_to` - ([@https://svn.boost.org/trac/boost/ticket/4170 #4170]). -* Ensured `unsigned char` is used with `isdigit` in `getaddrinfo` emulation - ([@https://svn.boost.org/trac/boost/ticket/4201 #4201]). -* Fixed handling of very small but non-zero timeouts - ([@https://svn.boost.org/trac/boost/ticket/4205 #4205]). -* Fixed crash that occurred when an empty buffer sequence was passed to a - composed read or write operation. -* Added missing `operator+` overload in `buffers_iterator` - ([@https://svn.boost.org/trac/boost/ticket/4382 #4382]). -* Implemented cancellation of `null_buffers` operations on Windows. - -[heading Asio 1.4.5 / Boost 1.43] - -* Improved performance. -* Reduced compile times. -* Reduced the size of generated code. -* Extended the guarantee that background threads don't call user code to all - asynchronous operations - ([@https://svn.boost.org/trac/boost/ticket/3923 #3923]). -* Changed to use edge-triggered epoll on Linux. -* Changed to use `timerfd` for dispatching timers on Linux, when available. -* Changed to use one-shot notifications with kqueue on Mac OS X and BSD - platforms. -* Added a bitmask type `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. -* Added `#define NOMINMAX` for all Windows compilers. Users can define - `BOOST_ASIO_NO_NOMINMAX` to suppress this definition - ([@https://svn.boost.org/trac/boost/ticket/3901 #3901]). -* Fixed a bug where 0-byte asynchronous reads were incorrectly passing an - `error::eof` result to the completion handler - ([@https://svn.boost.org/trac/boost/ticket/4023 #4023]). -* Changed the `io_control()` member functions to always call `ioctl` on the - underlying descriptor when modifying blocking mode - ([@https://svn.boost.org/trac/boost/ticket/3307 #3307]). -* Changed the resolver implementation to longer require the typedefs - `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. -* Fixed out-of-band handling for reactors not based on `select()`. -* Added new `BOOST_ASIO_DISABLE_THREADS` macro that allows Asio's threading - support to be independently disabled. -* Minor documentation improvements. - -[heading Asio 1.4.4 / Boost 1.42] - -* Added a new HTTP Server 4 example illustrating the use of stackless coroutines - with Asio. -* Changed handler allocation and invocation to use `boost::addressof` to get the - address of handler objects, rather than applying `operator&` directly - ([@https://svn.boost.org/trac/boost/ticket/2977 #2977]). -* Restricted MSVC buffer debugging workaround to 2008, as it causes a crash with - 2010 beta 2 ([@https://svn.boost.org/trac/boost/ticket/3796 #3796], - [@https://svn.boost.org/trac/boost/ticket/3822 #3822]). -* Fixed a problem with the lifetime of handler memory, where Windows needs the - `OVERLAPPED` structure to be valid until both the initiating function call - has returned and the completion packet has been delivered. -* Don't block signals while performing system calls, but instead restart the - calls if they are interrupted. -* Documented the guarantee made by strand objects with respect to order of - handler invocation. -* Changed strands to use a pool of implementations, to make copying of strands - cheaper. -* Ensured that kqueue support is enabled for BSD platforms - ([@https://svn.boost.org/trac/boost/ticket/3626 #3626]). -* Added a `boost_` prefix to the `extern "C"` thread entry point function - ([@https://svn.boost.org/trac/boost/ticket/3809 #3809]). -* In `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. -* Added a workaround for some broken Windows firewalls that make a socket - appear bound to 0.0.0.0 when it is in fact bound to 127.0.0.1. -* Applied a fix for reported excessive CPU usage under Solaris - ([@https://svn.boost.org/trac/boost/ticket/3670 #3670]). -* Added some support for platforms that use older compilers such as g++ 2.95 - ([@https://svn.boost.org/trac/boost/ticket/3743 #3743]). - -[heading Asio 1.4.3 / Boost 1.40] - -* Added a new ping example to illustrate the use of ICMP sockets. -* Changed the `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`. -* Changed some instances of the `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 - ([@https://svn.boost.org/trac/boost/ticket/2754 #2754]). -* Made Asio compatible with the OpenSSL 1.0 beta - ([@https://svn.boost.org/trac/boost/ticket/3256 #3256]). -* Eliminated a redundant system call in the Solaris [^/dev/poll] backend. -* Fixed a bug in resizing of the bucket array in the internal hash maps - ([@https://svn.boost.org/trac/boost/ticket/3095 #3095]). -* Ensured correct propagation of the error code when a synchronous accept fails - ([@https://svn.boost.org/trac/boost/ticket/3216 #3216]). -* Ensured correct propagation of the error code when a synchronous read or - write on a Windows HANDLE fails. -* Fixed failures reported when `_GLIBCXX_DEBUG` is defined - ([@https://svn.boost.org/trac/boost/ticket/3098 #3098]). -* Fixed custom memory allocation support for timers - ([@https://svn.boost.org/trac/boost/ticket/3107 #3107]). -* Tidied up various warnings reported by g++ - ([@https://svn.boost.org/trac/boost/ticket/1341 #1341], - [@https://svn.boost.org/trac/boost/ticket/2618 #2618]). -* Various documentation improvements, including more obvious hyperlinks to - function overloads, header file information, examples for the handler type - requirements, and adding enum values to the index - ([@https://svn.boost.org/trac/boost/ticket/3157 #3157], - [@https://svn.boost.org/trac/boost/ticket/2620 #2620]). - -[heading Asio 1.4.2 / Boost 1.39] - -* Implement automatic resizing of the bucket array in the internal hash maps. - This is to improve performance for very large numbers of asynchronous - operations and also to reduce memory usage for very small numbers. A new - macro `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.) -* Add performance optimisation for the Windows IOCP backend for when no timers - are used. -* Prevent locale settings from affecting formatting of TCP and UDP endpoints - ([@https://svn.boost.org/trac/boost/ticket/2682 #2682]). -* Fix a memory leak that occurred when an asynchronous SSL operation's - completion handler threw an exception - ([@https://svn.boost.org/trac/boost/ticket/2910 #2910]). -* Fix the implementation of `io_control()` so that it adheres to the - documented type requirements for IoControlCommand - ([@https://svn.boost.org/trac/boost/ticket/2820 #2820]). -* Fix incompatibility between Asio and ncurses.h - ([@https://svn.boost.org/trac/boost/ticket/2156 #2156]). -* On Windows, specifically handle the case when an overlapped `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 - ([@https://svn.boost.org/trac/boost/ticket/2936 #2936]). -* Fix system call wrappers to always clear the error on success, as POSIX - allows successful system calls to modify errno - ([@https://svn.boost.org/trac/boost/ticket/2953 #2953]). -* Don't include termios.h if `BOOST_ASIO_DISABLE_SERIAL_PORT` is defined - ([@https://svn.boost.org/trac/boost/ticket/2917 #2917]). -* Cleaned up some more MSVC level 4 warnings - ([@https://svn.boost.org/trac/boost/ticket/2828 #2828]). -* Various documentation fixes - ([@https://svn.boost.org/trac/boost/ticket/2871 #2871]). - -[heading Asio 1.4.1 / Boost 1.38] - -* Improved compatibility with some Windows firewall software. -* Ensured arguments to `windows::overlapped_ptr::complete()` are correctly - passed to the completion handler - ([@https://svn.boost.org/trac/boost/ticket/2614 #2614]). -* Fixed a link problem and multicast failure on QNX - ([@https://svn.boost.org/trac/boost/ticket/2504 #2504], - [@https://svn.boost.org/trac/boost/ticket/2530 #2530]). -* Fixed a compile error in SSL support on MinGW / g++ 3.4.5. -* Drop back to using a pipe for notification if eventfd is not available at - runtime on Linux ([@https://svn.boost.org/trac/boost/ticket/2683 #2683]). -* Various minor bug and documentation fixes - ([@https://svn.boost.org/trac/boost/ticket/2534 #2534], - [@https://svn.boost.org/trac/boost/ticket/2541 #2541], - [@https://svn.boost.org/trac/boost/ticket/2607 #2607], - [@https://svn.boost.org/trac/boost/ticket/2617 #2617], - [@https://svn.boost.org/trac/boost/ticket/2619 #2619]). - -[heading Asio 1.4.0 / Boost 1.37] - -* Enhanced CompletionCondition concept with the signature - `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). -* New windows::overlapped_ptr class to allow arbitrary overlapped I/O - functions (such as TransmitFile) to be used with Asio. -* On recent versions of Linux, an eventfd descriptor is now used (rather than - a pipe) to interrupt a blocked select/epoll reactor. -* Added const overloads of lowest_layer(). -* Synchronous read, write, accept and connect operations are now thread safe - (meaning that it is now permitted to perform concurrent synchronous - operations on an individual socket, if supported by the OS). -* Reactor-based io_service implementations now use lazy initialisation to - reduce the memory usage of an io_service object used only as a message - queue. - -[heading Asio 1.2.0 / Boost 1.36] - -* Added support for serial ports. -* Added support for UNIX domain sockets. -* Added support for raw sockets and ICMP. -* Added wrappers for POSIX stream-oriented file descriptors (excluding regular - files). -* Added wrappers for Windows stream-oriented `HANDLE`s such as named pipes - (requires `HANDLE`s that work with I/O completion ports). -* Added wrappers for Windows random-access `HANDLE`s such as files (requires - `HANDLE`s that work with I/O completion ports). -* Added support for reactor-style operations (i.e. they report readiness but - perform no I/O) using a new `null_buffers` type. -* Added an iterator type for bytewise traversal of buffer sequences. -* Added new `read_until()` and `async_read_until()` overloads that take a - user-defined function object for locating message boundaries. -* Added an experimental two-lock queue (enabled by defining - `BOOST_ASIO_ENABLE_TWO_LOCK_QUEUE`) that may provide better `io_service` - scalability across many processors. -* Various fixes, performance improvements, and more complete coverage of the - custom memory allocation support. - -[heading Asio 1.0.0 / Boost 1.35] - -First release of Asio as part of Boost. - -[endsect] diff --git a/boost-asio/doc/index.xml b/boost-asio/doc/index.xml deleted file mode 100644 index e5dcde988..000000000 --- a/boost-asio/doc/index.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - -
- -
diff --git a/boost-asio/doc/net_ts.qbk b/boost-asio/doc/net_ts.qbk deleted file mode 100644 index 7e12eaac0..000000000 --- a/boost-asio/doc/net_ts.qbk +++ /dev/null @@ -1,473 +0,0 @@ -[/ - / Copyright (c) 2003-2018 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:net_ts Networking TS compatibility] - -Boost.Asio now provides the interfaces and functionality specified by the "C++ -Extensions for Networking" Technical Specification. In addition to access via -the usual Boost.Asio header files, this functionality may be accessed through special -headers that correspond to the header files defined in the TS. These are listed -in the table below: - -[table - [[Networking TS header][Boost.Asio header]] - [[`#include `][`#include `]] - [[`#include `][`#include `]] - [[`#include `][`#include `]] - [[`#include `][`#include `]] - [[`#include `][`#include `]] - [[`#include `][`#include `]] - [[`#include `][`#include `]] - [[`#include `][`#include `]] -] - -In some cases the new Networking TS compatible interfaces supersede older Boost.Asio -facilities. In these cases the older interfaces have been deprecated. The table -below shows the new Networking TS interfaces and the facilities they replace: - -[table - [[New interface][Old interface][Notes]] - [ - [[link boost_asio.reference.io_context `io_context`]] - [[link boost_asio.reference.io_service `io_service`]] - [The name `io_service` is retained as a typedef.] - ] - [ - [[link boost_asio.reference.dispatch `dispatch`]] - [[link boost_asio.reference.io_context.dispatch `io_service::dispatch`]] - [The `dispatch` free function can be used to submit functions to any [link - boost_asio.reference.Executor1 Executor] or [link boost_asio.reference.ExecutionContext - ExecutionContext].] - ] - [ - [[link boost_asio.reference.dispatch `post`]] - [[link boost_asio.reference.io_context.post `io_service::post`]] - [The `dispatch` free function can be used to submit functions to any [link - boost_asio.reference.Executor1 Executor] or [link boost_asio.reference.ExecutionContext - ExecutionContext].] - ] - [ - [[link boost_asio.reference.dispatch `defer`]] - [[link boost_asio.reference.io_context.post `io_service::post`] when the [link - boost_asio.reference.asio_handler_is_continuation `asio_handler_is_continuation`] - hook returns true] - [The `defer` free function can be used to submit functions to any [link - boost_asio.reference.Executor1 Executor] or [link boost_asio.reference.ExecutionContext - ExecutionContext].] - ] - [ - [[link boost_asio.reference.io_context.poll `io_context::poll`]] - [[link boost_asio.reference.io_context.poll `io_service::poll`] overload that - takes `error_code&`] - [The `error_code` overload is not required.] - ] - [ - [[link boost_asio.reference.io_context.poll_one `io_context::poll_one`]] - [[link boost_asio.reference.io_context.poll_one `io_service::poll_one`] overload - that takes `error_code&`] - [The `error_code` overload is not required.] - ] - [ - [[link boost_asio.reference.io_context.run `io_context::run`]] - [[link boost_asio.reference.io_context.run `io_service::run`] overload that takes - `error_code&`] - [The `error_code` overload is not required.] - ] - [ - [[link boost_asio.reference.io_context.run_one `io_context::run_one`]] - [[link boost_asio.reference.io_context.run_one `io_service::run_one`] overload - that takes `error_code&`] - [The `error_code` overload is not required.] - ] - [ - [[link boost_asio.reference.io_context.run_for `io_context::run_for`], - [link boost_asio.reference.io_context.run_until `io_context::run_until`], - [link boost_asio.reference.io_context.run_one_for `io_context::run_one_for`], and - [link boost_asio.reference.io_context.run_one_until `io_context::run_one_until`]] - [] - [These functions add the ability to run an `io_context` for a limited time.] - ] - [ - [[link boost_asio.reference.io_context.restart `io_context::restart`]] - [[link boost_asio.reference.io_context.reset `io_service::reset`]] - [] - ] - [ - [[link boost_asio.reference.execution_context `execution_context`], [link - boost_asio.reference.execution_context__service `execution_context::service`], - and [link boost_asio.reference.execution_context__id `execution_context::id`]] - [[link boost_asio.reference.io_context `io_service`], [link - boost_asio.reference.io_context__service `io_service::service`], and [link - boost_asio.reference.execution_context__id `io_service::id`]] - [The service-related functionality has been moved to the - `execution_context` base class. This may also be used as a base for - creating custom execution contexts.] - ] - [ - [[link boost_asio.reference.execution_context.make_service `make_service`]] - [[link boost_asio.reference.execution_context.add_service `add_service`]] - [] - ] - [ - [[link boost_asio.reference.strand `strand`]] - [[link boost_asio.reference.io_context__strand `io_service::strand`]] - [This template works with any valid executor, and is itself a valid - executor.] - ] - [ - [[link boost_asio.reference.executor_work_guard `executor_work_guard`] and [link - boost_asio.reference.make_work_guard `make_work_guard`]] - [[link boost_asio.reference.io_context__work `io_service::work`]] - [Work tracking is now covered by the [link boost_asio.reference.Executor1 - Executor] requirements. These templates work with any valid executor.] - ] - [ - [[link boost_asio.reference.executor_binder `executor_binder`] and [link - boost_asio.reference.bind_executor `bind_executor`]] - [[link boost_asio.reference.io_context.wrap `io_service::wrap`] and - [link boost_asio.reference.io_context__strand.wrap `io_service::strand::wrap`]] - [These templates work with any valid executor.] - ] - [ - [[link boost_asio.reference.async_result `async_result`] with `CompletionToken` - and `Signature` template parameters] - [[link boost_asio.reference.handler_type `handler_type`] and single parameter - [link boost_asio.reference.async_result_lt__Handler__gt_ `async_result`]] - [The `async_result` trait is now the single point of customisation for - asynchronous operation completion handlers and return type.] - ] - [ - [[link boost_asio.reference.associated_executor `associated_executor`] and [link - boost_asio.reference.get_associated_executor `get_associated_executor`]] - [[link boost_asio.reference.asio_handler_invoke `asio_handler_invoke`]] - [The handler invocation hook has been replaced by the new [link - boost_asio.reference.Executor1 Executor] requirements and the associated executor - traits.] - ] - [ - [[link boost_asio.reference.associated_allocator `associated_allocator`] and - [link boost_asio.reference.get_associated_allocator `get_associated_allocator`]] - [[link boost_asio.reference.asio_handler_allocate `asio_handler_allocate`] and - [link boost_asio.reference.asio_handler_deallocate `asio_handler_deallocate`]] - [The handler allocation hooks have been replaced by the standard Allocator - requirements and the associated allocator traits.] - ] - [ - [[link boost_asio.reference.const_buffer.data `const_buffer::data`] and [link - boost_asio.reference.mutable_buffer.data `mutable_buffer::data`]] - [[link boost_asio.reference.buffer_cast `buffer_cast`]] - [] - ] - [ - [[link boost_asio.reference.const_buffer.size `const_buffer::size`] and [link - boost_asio.reference.mutable_buffer.size `mutable_buffer::size`]] - [[link boost_asio.reference.buffer_size `buffer_size`] for single buffers] - [`buffer_size` is not deprecated for single buffers as `const_buffer` and - `mutable_buffer` now satisfy the buffer sequence requirements] - ] - [ - [[link boost_asio.reference.const_buffer `const_buffer`]] - [[link boost_asio.reference.const_buffers_1 `const_buffers_1`]] - [The [link boost_asio.reference.ConstBufferSequence ConstBufferSequence] - requirements have been modified such that `const_buffer` now satisfies - them.] - ] - [ - [[link boost_asio.reference.mutable_buffer `mutable_buffer`]] - [[link boost_asio.reference.mutable_buffers_1 `mutable_buffers_1`]] - [The [link boost_asio.reference.MutableBufferSequence MutableBufferSequence] - requirements have been modified such that `mutable_buffer` now satisfies - them.] - ] - [ - [[link boost_asio.reference.basic_socket.get_executor - `basic_socket::get_executor`] (and corresponding member for I/O objects - such as timers, serial ports, etc.)] - [[link boost_asio.reference.basic_io_object.get_io_service - `basic_io_object::get_io_service`]] - [Use `get_executor().context()` to obtain the associated `io_context`.] - ] - [ - [[link boost_asio.reference.socket_base.max_listen_connections - `socket_base::max_listen_connections`]] - [[link boost_asio.reference.socket_base.max_connections - `socket_base::max_connections`]] - [] - ] - [ - [[link boost_asio.reference.socket_base.wait_type `socket_base::wait_type`], - [link boost_asio.reference.basic_socket.wait `basic_socket::wait`], [link - boost_asio.reference.basic_socket.async_wait `basic_socket::async_wait`], [link - boost_asio.reference.basic_socket_acceptor.wait `basic_socket_acceptor::wait`], - and [link boost_asio.reference.basic_socket_acceptor.async_wait - `basic_socket_acceptor::async_wait`]] - [[link boost_asio.reference.null_buffers `null_buffers`]] - [Operations for reactive I/O.] - ] - [ - [[link boost_asio.reference.basic_socket_acceptor.accept - `basic_socket_acceptor::accept`] returns a socket] - [[link boost_asio.reference.basic_socket_acceptor.accept - `basic_socket_acceptor::accept`] takes a socket by reference] - [Uses move support so requires C++11 or later. To accept a connection into - a socket object on a different `io_context`, pass the destination context - to `accept`.] - ] - [ - [[link boost_asio.reference.basic_socket_acceptor.async_accept - `basic_socket_acceptor::async_accept`] passes socket to handler] - [[link boost_asio.reference.basic_socket_acceptor.async_accept - `basic_socket_acceptor::async_accept`] takes a socket by reference] - [Uses move support so requires C++11 or later. To accept a connection into - a socket object on a different `io_context`, pass the destination context - to `async_accept`.] - ] - [ - [[link boost_asio.reference.connect `connect`] overloads that take a range] - [[link boost_asio.reference.connect `connect`] overloads that take a single - iterator] - [The [link boost_asio.reference.ip__basic_resolver.resolve - `ip::basic_resolver::resolve`] function now returns a range. When the - `resolve` function's result is passed directly to `connect`, the range - overload will be selected.] - ] - [ - [[link boost_asio.reference.async_connect `async_connect`] overloads that take a - range] - [[link boost_asio.reference.async_connect `async_connect`] overloads that take a - single iterator] - [The [link boost_asio.reference.ip__basic_resolver.resolve - `ip::basic_resolver::resolve`] function now returns a range. When the - `resolve` function's result is passed directly to `async_connect`, the - range overload will be selected.] - ] - [ - [[link boost_asio.reference.basic_socket_streambuf.duration - `basic_socket_streambuf::duration`]] - [[link boost_asio.reference.basic_socket_streambuf.duration_type - `basic_socket_streambuf::duration_type`]] - [] - ] - [ - [[link boost_asio.reference.basic_socket_streambuf.time_point - `basic_socket_streambuf::time_point`]] - [[link boost_asio.reference.basic_socket_streambuf.time_type - `basic_socket_streambuf::time_type`]] - [] - ] - [ - [[link boost_asio.reference.basic_socket_streambuf.expiry - `basic_socket_streambuf::expiry`]] - [[link boost_asio.reference.basic_socket_streambuf.expires_at - `basic_socket_streambuf::expires_at`] and [link - boost_asio.reference.basic_socket_streambuf.expires_from_now - `basic_socket_streambuf::expires_from_now`] getters] - [] - ] - [ - [[link boost_asio.reference.basic_socket_streambuf.expires_after - `basic_socket_streambuf::expires_after`]] - [[link boost_asio.reference.basic_socket_streambuf.expires_from_now - `basic_socket_streambuf::expires_from_now`] setter] - [] - ] - [ - [[link boost_asio.reference.basic_socket_streambuf.error - `basic_socket_streambuf::error`]] - [[link boost_asio.reference.basic_socket_streambuf.puberror - `basic_socket_streambuf::puberror`]] - [] - ] - [ - [[link boost_asio.reference.basic_socket_iostream.duration - `basic_socket_iostream::duration`]] - [[link boost_asio.reference.basic_socket_iostream.duration_type - `basic_socket_iostream::duration_type`]] - [] - ] - [ - [[link boost_asio.reference.basic_socket_iostream.time_point - `basic_socket_iostream::time_point`]] - [[link boost_asio.reference.basic_socket_iostream.time_type - `basic_socket_iostream::time_type`]] - [] - ] - [ - [[link boost_asio.reference.basic_socket_iostream.expiry - `basic_socket_iostream::expiry`]] - [[link boost_asio.reference.basic_socket_iostream.expires_at - `basic_socket_iostream::expires_at`] and [link - boost_asio.reference.basic_socket_iostream.expires_from_now - `basic_socket_iostream::expires_from_now`] getters] - [] - ] - [ - [[link boost_asio.reference.basic_socket_iostream.expires_after - `basic_socket_iostream::expires_after`]] - [[link boost_asio.reference.basic_socket_iostream.expires_from_now - `basic_socket_iostream::expires_from_now`] setter] - [] - ] - [ - [[link boost_asio.reference.basic_waitable_timer.cancel - `basic_waitable_timer::cancel`]] - [[link boost_asio.reference.basic_waitable_timer.cancel - `basic_waitable_timer::cancel`] overload that takes `error_code&`] - [The `error_code` overload is not required.] - ] - [ - [[link boost_asio.reference.basic_waitable_timer.cancel_one - `basic_waitable_timer::cancel_one`]] - [[link boost_asio.reference.basic_waitable_timer.cancel_one - `basic_waitable_timer::cancel_one`] overload that takes `error_code&`] - [The `error_code` overload is not required.] - ] - [ - [[link boost_asio.reference.basic_waitable_timer.expires_at - `basic_waitable_timer::expires_at`] setter] - [[link boost_asio.reference.basic_waitable_timer.expires_at - `basic_waitable_timer::expires_at`] setter that takes `error_code&`] - [The `error_code` overload is not required.] - ] - [ - [[link boost_asio.reference.basic_waitable_timer.expiry - `basic_waitable_timer::expiry`]] - [[link boost_asio.reference.basic_waitable_timer.expires_at - `basic_waitable_timer::expires_at`] and [link - boost_asio.reference.basic_waitable_timer.expires_from_now - `basic_waitable_timer::expires_from_now`] getters] - [] - ] - [ - [[link boost_asio.reference.basic_waitable_timer.expires_after - `basic_waitable_timer::expires_after`]] - [[link boost_asio.reference.basic_waitable_timer.expires_from_now - `basic_waitable_timer::expires_from_now`] setter] - [] - ] - [ - [[link boost_asio.reference.ip__address.make_address `ip::make_address`]] - [[link boost_asio.reference.ip__address.from_string `ip::address::from_string`]] - [] - ] - [ - [[link boost_asio.reference.ip__address_v4.make_address_v4 `ip::make_address_v4`]] - [[link boost_asio.reference.ip__address_v4.from_string - `ip::address_v4::from_string`] and [link - boost_asio.reference.ip__address_v6.to_v4 `ip::address_v6::to_v4`]] - [] - ] - [ - [[link boost_asio.reference.ip__address_v6.make_address_v6 `ip::make_address_v6`]] - [[link boost_asio.reference.ip__address_v6.from_string - `ip::address_v6::from_string`] and [link - boost_asio.reference.ip__address_v6.v4_mapped `ip::address_v6::v4_mapped`]] - [] - ] - [ - [[link boost_asio.reference.ip__address.to_string `ip::address::to_string`]] - [[link boost_asio.reference.ip__address.to_string `ip::address::to_string`] that - takes `error_code&`] - [The `error_code` overload is not required.] - ] - [ - [[link boost_asio.reference.ip__address_v4.to_string `ip::address_v4::to_string`]] - [[link boost_asio.reference.ip__address_v4.to_string `ip::address_v4::to_string`] - that takes `error_code&`] - [The `error_code` overload is not required.] - ] - [ - [[link boost_asio.reference.ip__address_v6.to_string `ip::address_v6::to_string`]] - [[link boost_asio.reference.ip__address_v6.to_string `ip::address_v6::to_string`] - that takes `error_code&`] - [The `error_code` overload is not required.] - ] - [ - [No replacement] - [[link boost_asio.reference.ip__address_v6.is_v4_compatible - `ip::address_v6::is_v4_compatible`] and [link - boost_asio.reference.ip__address_v6.v4_compatible - `ip::address_v6::v4_compatible`]] - [] - ] - [ - [[link boost_asio.reference.ip__network_v4 `ip::network_v4`]] - [[link boost_asio.reference.ip__address_v4.broadcast `ip::address_v4::broadcast`], - [link boost_asio.reference.ip__address_v4.is_class_a `ip::address_v4::is_class_a`], - [link boost_asio.reference.ip__address_v4.is_class_b `ip::address_v4::is_class_b`], - [link boost_asio.reference.ip__address_v4.is_class_c `ip::address_v4::is_class_c`], - and [link boost_asio.reference.ip__address_v4.netmask `ip::address_v4::netmask`]] - [The `network_v4` class adds the ability to manipulate IPv4 network - addresses using CIDR notation.] - ] - [ - [[link boost_asio.reference.ip__network_v6 `ip::network_v6`]] - [] - [The `network_v6` class adds the ability to manipulate IPv6 network - addresses using CIDR notation.] - ] - [ - [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v4__gt_ - `ip::address_v4_iterator`] and [link - boost_asio.reference.ip__basic_address_range_lt__address_v4__gt_ - `ip::address_v4_range`]] - [] - [The `ip::address_v4_iterator` and `address_v4_range` classes add the - ability to iterate over all, or a subset of, IPv4 addresses.] - ] - [ - [[link boost_asio.reference.ip__basic_address_iterator_lt__address_v6__gt_ - `ip::address_v6_iterator`] and [link - boost_asio.reference.ip__basic_address_range_lt__address_v6__gt_ - `ip::address_v6_range`]] - [] - [The `ip::address_v6_iterator` and `address_v6_range` classes add the - ability to iterate over all, or a subset of, IPv6 addresses.] - ] - [ - [[link boost_asio.reference.ip__basic_resolver.results_type - `ip::basic_resolver::results_type`]] - [[link boost_asio.reference.ip__basic_resolver.iterator - `ip::basic_resolver::iterator`]] - [Resolvers now produce ranges rather than single iterators.] - ] - [ - [[link boost_asio.reference.ip__basic_resolver.resolve - `ip::basic_resolver::resolve`] overloads taking hostname and service as - arguments] - [[link boost_asio.reference.ip__basic_resolver.resolve - `ip::basic_resolver::resolve`] overloads taking a [link - boost_asio.reference.ip__basic_resolver.query `ip::basic_resolver::query`]] - [] - ] - [ - [[link boost_asio.reference.ip__basic_resolver.resolve - `ip::basic_resolver::resolve`] returns a range] - [[link boost_asio.reference.ip__basic_resolver.resolve - `ip::basic_resolver::resolve`] returns a single iterator] - [] - ] - [ - [[link boost_asio.reference.ip__basic_resolver.async_resolve - `ip::basic_resolver::async_resolve`] overloads taking hostname and service - as arguments] - [[link boost_asio.reference.ip__basic_resolver.async_resolve - `ip::basic_resolver::async_resolve`] overloads taking a [link - boost_asio.reference.ip__basic_resolver.query `ip::basic_resolver::query`]] - [] - ] - [ - [[link boost_asio.reference.ip__basic_resolver.async_resolve - `ip::basic_resolver::async_resolve`] calls the handler with a range] - [[link boost_asio.reference.ip__basic_resolver.async_resolve - `ip::basic_resolver::async_resolve`] calls the handler with a single - iterator] - [] - ] -] - -[endsect] diff --git a/boost-asio/doc/noncopyable_dox.txt b/boost-asio/doc/noncopyable_dox.txt deleted file mode 100644 index d649f94e0..000000000 --- a/boost-asio/doc/noncopyable_dox.txt +++ /dev/null @@ -1,10 +0,0 @@ -// -// Copyright (c) 2003-2018 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) -// - -/** -\class noncopyable -*/ diff --git a/boost-asio/doc/overview.qbk b/boost-asio/doc/overview.qbk deleted file mode 100644 index 974140e2d..000000000 --- a/boost-asio/doc/overview.qbk +++ /dev/null @@ -1,113 +0,0 @@ -[/ - / Copyright (c) 2003-2018 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:overview Overview] - -* [link boost_asio.overview.rationale Rationale] -* [link boost_asio.overview.core Core Concepts and Functionality] - * [link boost_asio.overview.core.basics Basic Boost.Asio Anatomy] - * [link boost_asio.overview.core.async The Proactor Design Pattern: Concurrency Without Threads] - * [link boost_asio.overview.core.threads Threads and Boost.Asio] - * [link boost_asio.overview.core.strands Strands: Use Threads Without Explicit Locking] - * [link boost_asio.overview.core.buffers Buffers] - * [link boost_asio.overview.core.streams Streams, Short Reads and Short Writes] - * [link boost_asio.overview.core.reactor Reactor-Style Operations] - * [link boost_asio.overview.core.line_based Line-Based Operations] - * [link boost_asio.overview.core.allocation Custom Memory Allocation] - * [link boost_asio.overview.core.handler_tracking Handler Tracking] - * [link boost_asio.overview.core.concurrency_hint Concurrency Hints] - * [link boost_asio.overview.core.coroutine Stackless Coroutines] - * [link boost_asio.overview.core.spawn Stackful Coroutines] - * [link boost_asio.overview.core.coroutines_ts Coroutines TS Support (experimental)] -* [link boost_asio.overview.networking Networking] - * [link boost_asio.overview.networking.protocols TCP, UDP and ICMP] - * [link boost_asio.overview.networking.other_protocols Support for Other Protocols] - * [link boost_asio.overview.networking.iostreams Socket Iostreams] - * [link boost_asio.overview.networking.bsd_sockets The BSD Socket API and Boost.Asio] -* [link boost_asio.overview.timers Timers] -* [link boost_asio.overview.serial_ports Serial Ports] -* [link boost_asio.overview.signals Signal Handling] -* [link boost_asio.overview.posix POSIX-Specific Functionality] - * [link boost_asio.overview.posix.local UNIX Domain Sockets] - * [link boost_asio.overview.posix.stream_descriptor Stream-Oriented File Descriptors] - * [link boost_asio.overview.posix.fork Fork] -* [link boost_asio.overview.windows Windows-Specific Functionality] - * [link boost_asio.overview.windows.stream_handle Stream-Oriented HANDLEs] - * [link boost_asio.overview.windows.random_access_handle Random-Access HANDLEs] - * [link boost_asio.overview.windows.object_handle Object HANDLEs] -* [link boost_asio.overview.ssl SSL] -* [link boost_asio.overview.cpp2011 C++ 2011 Support] - * [link boost_asio.overview.cpp2011.move_objects Movable I/O Objects] - * [link boost_asio.overview.cpp2011.move_handlers Movable Handlers] - * [link boost_asio.overview.cpp2011.variadic Variadic Templates] - * [link boost_asio.overview.cpp2011.array Array Container] - * [link boost_asio.overview.cpp2011.atomic Atomics] - * [link boost_asio.overview.cpp2011.shared_ptr Shared Pointers] - * [link boost_asio.overview.cpp2011.chrono Chrono] - * [link boost_asio.overview.cpp2011.futures Futures] -* [link boost_asio.overview.implementation Platform-Specific Implementation Notes] - -[include overview/rationale.qbk] - -[section:core Core Concepts and Functionality] - -* [link boost_asio.overview.core.basics Basic Boost.Asio Anatomy] -* [link boost_asio.overview.core.async The Proactor Design Pattern: Concurrency Without Threads] -* [link boost_asio.overview.core.threads Threads and Boost.Asio] -* [link boost_asio.overview.core.strands Strands: Use Threads Without Explicit Locking] -* [link boost_asio.overview.core.buffers Buffers] -* [link boost_asio.overview.core.streams Streams, Short Reads and Short Writes] -* [link boost_asio.overview.core.reactor Reactor-Style Operations] -* [link boost_asio.overview.core.line_based Line-Based Operations] -* [link boost_asio.overview.core.allocation Custom Memory Allocation] -* [link boost_asio.overview.core.handler_tracking Handler Tracking] -* [link boost_asio.overview.core.concurrency_hint Concurrency Hints] -* [link boost_asio.overview.core.coroutine Stackless Coroutines] -* [link boost_asio.overview.core.spawn Stackful Coroutines] -* [link boost_asio.overview.core.coroutines_ts Coroutines TS Support (experimental)] - -[include overview/basics.qbk] -[include overview/async.qbk] -[include overview/threads.qbk] -[include overview/strands.qbk] -[include overview/buffers.qbk] -[include overview/streams.qbk] -[include overview/reactor.qbk] -[include overview/line_based.qbk] -[include overview/allocation.qbk] -[include overview/handler_tracking.qbk] -[include overview/concurrency_hint.qbk] -[include overview/coroutine.qbk] -[include overview/spawn.qbk] -[include overview/coroutines_ts.qbk] - -[endsect] - -[section:networking Networking] - -* [link boost_asio.overview.networking.protocols TCP, UDP and ICMP] -* [link boost_asio.overview.networking.other_protocols Support for Other Protocols] -* [link boost_asio.overview.networking.iostreams Socket Iostreams] -* [link boost_asio.overview.networking.bsd_sockets The BSD Socket API and Boost.Asio] - -[include overview/protocols.qbk] -[include overview/other_protocols.qbk] -[include overview/iostreams.qbk] -[include overview/bsd_sockets.qbk] - -[endsect] - -[include overview/timers.qbk] -[include overview/serial_ports.qbk] -[include overview/signals.qbk] -[include overview/posix.qbk] -[include overview/windows.qbk] -[include overview/ssl.qbk] -[include overview/cpp2011.qbk] -[include overview/implementation.qbk] - -[endsect] diff --git a/boost-asio/doc/overview/allocation.qbk b/boost-asio/doc/overview/allocation.qbk deleted file mode 100644 index bca72130b..000000000 --- a/boost-asio/doc/overview/allocation.qbk +++ /dev/null @@ -1,89 +0,0 @@ -[/ - / Copyright (c) 2003-2018 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:allocation Custom Memory Allocation] - -Many asynchronous operations need to allocate an object to store state -associated with the operation. For example, a Win32 implementation needs -`OVERLAPPED`-derived objects to pass to Win32 API functions. - -Furthermore, programs typically contain easily identifiable chains of -asynchronous operations. A half duplex protocol implementation (e.g. an HTTP -server) would have a single chain of operations per client (receives followed -by sends). A full duplex protocol implementation would have two chains -executing in parallel. Programs should be able to leverage this knowledge to -reuse memory for all asynchronous operations in a chain. - -Given a copy of a user-defined `Handler` object `h`, if the implementation -needs to allocate memory associated with that handler it will obtain an -allocator using the `get_associated_allocator` function. For example: - - boost::asio::associated_allocator_t a = boost::asio::get_associated_allocator(h); - -The associated allocator must satisfy the standard Allocator requirements. - -By default, handlers use the standard allocator (which is implemented in terms -of `::operator new()` and `::operator delete()`). The allocator may be -customised for a particular handler type by specifying a nested type -`allocator_type` and member function `get_allocator()`: - - class my_handler - { - public: - // Custom implementation of Allocator type requirements. - typedef my_allocator allocator_type; - - // Return a custom allocator implementation. - allocator_type get_allocator() const noexcept - { - return my_allocator(); - } - - void operator()() { ... } - }; - -In more complex cases, the `associated_allocator` template may be partially -specialised directly: - - namespace boost { namespace asio { - - template - struct associated_allocator - { - // Custom implementation of Allocator type requirements. - typedef my_allocator type; - - // Return a custom allocator implementation. - static type get(const my_handler&, - const Allocator& a = Allocator()) noexcept - { - return my_allocator(); - } - }; - - } } // namespace boost::asio - -The implementation guarantees that the deallocation will occur before the -associated handler is invoked, which means the memory is ready to be reused for -any new asynchronous operations started by the handler. - -The custom memory allocation functions may be called from any user-created -thread that is calling a library function. The implementation guarantees that, -for the asynchronous operations included the library, the implementation will -not make concurrent calls to the memory allocation functions for that handler. -The implementation will insert appropriate memory barriers to ensure correct -memory visibility should allocation functions need to be called from different -threads. - -[heading See Also] - -[link boost_asio.reference.associated_allocator associated_allocator], -[link boost_asio.reference.get_associated_allocator get_associated_allocator], -[link boost_asio.examples.cpp03_examples.allocation custom memory allocation example (C++03)], -[link boost_asio.examples.cpp11_examples.allocation custom memory allocation example (C++11)]. - -[endsect] diff --git a/boost-asio/doc/overview/async.qbk b/boost-asio/doc/overview/async.qbk deleted file mode 100644 index 76bcd8479..000000000 --- a/boost-asio/doc/overview/async.qbk +++ /dev/null @@ -1,185 +0,0 @@ -[/ - / Copyright (c) 2003-2018 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:async The Proactor Design Pattern: Concurrency Without Threads] - -The Boost.Asio library offers side-by-side support for synchronous and asynchronous -operations. The asynchronous support is based on the Proactor design pattern -[link boost_asio.overview.core.async.references \[POSA2\]]. The advantages and -disadvantages of this approach, when compared to a synchronous-only or Reactor -approach, are outlined below. - -[heading Proactor and Boost.Asio] - -Let us examine how the Proactor design pattern is implemented in Boost.Asio, -without reference to platform-specific details. - -[$boost_asio/proactor.png] - -[*Proactor design pattern (adapted from \[POSA2\])] - -[mdash] Asynchronous Operation - -[:Defines an operation that is executed asynchronously, such as an asynchronous -read or write on a socket.] - -[mdash] Asynchronous Operation Processor - -[:Executes asynchronous operations and queues events on a completion event -queue when operations complete. From a high-level point of view, internal -services like `reactive_socket_service` are asynchronous operation processors.] - -[mdash] Completion Event Queue - -[:Buffers completion events until they are dequeued by an asynchronous event -demultiplexer.] - -[mdash] Completion Handler - -[:Processes the result of an asynchronous operation. These are function -objects, often created using `boost::bind`.] - -[mdash] Asynchronous Event Demultiplexer - -[:Blocks waiting for events to occur on the completion event queue, and returns -a completed event to its caller.] - -[mdash] Proactor - -[:Calls the asynchronous event demultiplexer to dequeue events, and dispatches -the completion handler (i.e. invokes the function object) associated with the -event. This abstraction is represented by the `io_context` class.] - -[mdash] Initiator - -[:Application-specific code that starts asynchronous operations. The initiator -interacts with an asynchronous operation processor via a high-level interface -such as `basic_stream_socket`, which in turn delegates to a service like -`reactive_socket_service`.] - -[heading Implementation Using Reactor] - -On many platforms, Boost.Asio implements the Proactor design pattern in terms -of a Reactor, such as `select`, `epoll` or `kqueue`. This implementation -approach corresponds to the Proactor design pattern as follows: - -[mdash] Asynchronous Operation Processor - -[:A reactor implemented using `select`, `epoll` or `kqueue`. When the reactor -indicates that the resource is ready to perform the operation, the processor -executes the asynchronous operation and enqueues the associated completion -handler on the completion event queue.] - -[mdash] Completion Event Queue - -[:A linked list of completion handlers (i.e. function objects).] - -[mdash] Asynchronous Event Demultiplexer - -[:This is implemented by waiting on an event or condition variable until a -completion handler is available in the completion event queue.] - -[heading Implementation Using Windows Overlapped I/O] - -On Windows NT, 2000 and XP, Boost.Asio takes advantage of overlapped I/O to -provide an efficient implementation of the Proactor design pattern. This -implementation approach corresponds to the Proactor design pattern as follows: - -[mdash] Asynchronous Operation Processor - -[:This is implemented by the operating system. Operations are initiated by -calling an overlapped function such as `AcceptEx`.] - -[mdash] Completion Event Queue - -[:This is implemented by the operating system, and is associated with an I/O -completion port. There is one I/O completion port for each `io_context` -instance.] - -[mdash] Asynchronous Event Demultiplexer - -[:Called by Boost.Asio to dequeue events and their associated completion -handlers.] - -[heading Advantages] - -[mdash] Portability. - -[:Many operating systems offer a native asynchronous I/O API (such as -overlapped I/O on __Windows__) as the preferred option for developing high -performance network applications. The library may be implemented in terms of -native asynchronous I/O. However, if native support is not available, the -library may also be implemented using synchronous event demultiplexors that -typify the Reactor pattern, such as __POSIX__ `select()`.] - -[mdash] Decoupling threading from concurrency. - -[:Long-duration operations are performed asynchronously by the implementation -on behalf of the application. Consequently applications do not need to spawn -many threads in order to increase concurrency.] - -[mdash] Performance and scalability. - -[:Implementation strategies such as thread-per-connection (which a -synchronous-only approach would require) can degrade system performance, due to -increased context switching, synchronisation and data movement among CPUs. With -asynchronous operations it is possible to avoid the cost of context switching -by minimising the number of operating system threads [mdash] typically a -limited resource [mdash] and only activating the logical threads of control -that have events to process.] - -[mdash] Simplified application synchronisation. - -[:Asynchronous operation completion handlers can be written as though they -exist in a single-threaded environment, and so application logic can be -developed with little or no concern for synchronisation issues.] - -[mdash] Function composition. - -[:Function composition refers to the implementation of functions to provide a -higher-level operation, such as sending a message in a particular format. Each -function is implemented in terms of multiple calls to lower-level read or write -operations.] - -[:For example, consider a protocol where each message consists of a -fixed-length header followed by a variable length body, where the length of the -body is specified in the header. A hypothetical read_message operation could be -implemented using two lower-level reads, the first to receive the header and, -once the length is known, the second to receive the body.] - -[:To compose functions in an asynchronous model, asynchronous operations can be -chained together. That is, a completion handler for one operation can initiate -the next. Starting the first call in the chain can be encapsulated so that the -caller need not be aware that the higher-level operation is implemented as a -chain of asynchronous operations.] - -[:The ability to compose new operations in this way simplifies the development -of higher levels of abstraction above a networking library, such as functions -to support a specific protocol.] - -[heading Disadvantages] - -[mdash] Program complexity. - -[:It is more difficult to develop applications using asynchronous mechanisms -due to the separation in time and space between operation initiation and -completion. Applications may also be harder to debug due to the inverted flow -of control.] - -[mdash] Memory usage. - -[:Buffer space must be committed for the duration of a read or write operation, -which may continue indefinitely, and a separate buffer is required for each -concurrent operation. The Reactor pattern, on the other hand, does not require -buffer space until a socket is ready for reading or writing.] - -[heading References] - -\[POSA2\] D. Schmidt et al, ['Pattern Oriented Software Architecture, Volume -2]. Wiley, 2000. - -[endsect] diff --git a/boost-asio/doc/overview/async_op1.dot b/boost-asio/doc/overview/async_op1.dot deleted file mode 100644 index 9abfc0a99..000000000 --- a/boost-asio/doc/overview/async_op1.dot +++ /dev/null @@ -1,78 +0,0 @@ -digraph g -{ - graph - [ - nodesep="0.2" - ]; - - edge - [ - fontname="Helvetica", - fontsize=10, - labelfontname="Helvetica", - labelfontsize=10 - ]; - - node - [ - fontname="Helvetica", - fontsize=10, - shape=box - ]; - - edge - [ - arrowhead="open" - ] - - // Program elements. - { - operating_system [ label="Operating System", shape=ellipse ]; - io_service [ label="io_service" ]; - io_object [ label="I/O Object\ne.g. socket" ]; - your_program [ label="Your Program" ]; - your_completion_handler [ label="Your Completion Handler" ]; - } - - // Owning relationships. - { - edge [ arrowtail="diamond" ]; - your_program:e -> your_completion_handler:n; - your_program:w -> io_object:nw; - your_program:se -> io_service:ne; - } - - // Non-owning relationships; - { - io_object:sw -> io_service:w; - } - - // Visible actions. - { - edge [ style="dashed", color="#808080" ]; - - // Forward actions. - { - your_program:sw -> io_object:n [ label="1" ]; - io_object:s -> io_service:nw [ label="2" ]; - io_service:s -> operating_system:n [ label="3" ]; - } - } - - // Invisible actions. - { - edge [ style="invis" ]; - - // Forward actions. - { - your_program:s -> io_service:n [ label="5" ]; - } - - // Reverse actions. - { - edge [ arrowhead="none", arrowtail="open" ]; - //io_service:s -> operating_system:n [ label="4" ]; - your_completion_handler:s -> io_service:e [ label="6" ]; - } - } -} diff --git a/boost-asio/doc/overview/async_op1.png b/boost-asio/doc/overview/async_op1.png deleted file mode 100644 index 0de79911e..000000000 Binary files a/boost-asio/doc/overview/async_op1.png and /dev/null differ diff --git a/boost-asio/doc/overview/async_op2.dot b/boost-asio/doc/overview/async_op2.dot deleted file mode 100644 index 49067ac3d..000000000 --- a/boost-asio/doc/overview/async_op2.dot +++ /dev/null @@ -1,78 +0,0 @@ -digraph g -{ - graph - [ - nodesep="0.2" - ]; - - edge - [ - fontname="Helvetica", - fontsize=10, - labelfontname="Helvetica", - labelfontsize=10 - ]; - - node - [ - fontname="Helvetica", - fontsize=10, - shape=box - ]; - - edge - [ - arrowhead="open" - ] - - // Program elements. - { - operating_system [ label="Operating System", shape=ellipse ]; - io_service [ label="io_service" ]; - io_object [ label="I/O Object\ne.g. socket" ]; - your_program [ label="Your Program" ]; - your_completion_handler [ label="Your Completion Handler" ]; - } - - // Owning relationships. - { - edge [ arrowtail="diamond" ]; - your_program:e -> your_completion_handler:n; - your_program:w -> io_object:nw; - your_program:se -> io_service:ne; - } - - // Non-owning relationships; - { - io_object:sw -> io_service:w; - } - - // Visible actions. - { - edge [ style="dashed", color="#808080" ]; - - // Forward actions. - { - your_program:s -> io_service:n [ label="5" ]; - } - - // Reverse actions. - { - edge [ arrowhead="none", arrowtail="open" ]; - io_service:s -> operating_system:n [ label="4" ]; - your_completion_handler:s -> io_service:e [ label="6" ]; - } - } - - // Invisible actions. - { - edge [ style="invis" ]; - - // Forward actions. - { - your_program:sw -> io_object:n [ label="1" ]; - io_object:s -> io_service:nw [ label="2" ]; - //io_service:s -> operating_system:n [ label="3" ]; - } - } -} diff --git a/boost-asio/doc/overview/async_op2.png b/boost-asio/doc/overview/async_op2.png deleted file mode 100644 index 9b8d3c087..000000000 Binary files a/boost-asio/doc/overview/async_op2.png and /dev/null differ diff --git a/boost-asio/doc/overview/basics.qbk b/boost-asio/doc/overview/basics.qbk deleted file mode 100644 index 19249c292..000000000 --- a/boost-asio/doc/overview/basics.qbk +++ /dev/null @@ -1,106 +0,0 @@ -[/ - / Copyright (c) 2003-2018 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:basics Basic Boost.Asio Anatomy] - -Boost.Asio may be used to perform both synchronous and asynchronous operations on I/O -objects such as sockets. Before using Boost.Asio it may be useful to get a conceptual -picture of the various parts of Boost.Asio, your program, and how they work together. - -As an introductory example, let's consider what happens when you perform a -connect operation on a socket. We shall start by examining synchronous -operations. - -[$boost_asio/sync_op.png] - -[*Your program] will have at least one [*io_context] object. The [*io_context] -represents [*your program]'s link to the [*operating system]'s I/O services. - - boost::asio::io_context io_context; - -To perform I/O operations [*your program] will need an [*I/O object] such as a -TCP socket: - - boost::asio::ip::tcp::socket socket(io_context); - -When a synchronous connect operation is performed, the following sequence of -events occurs: - -1. [*Your program] initiates the connect operation by calling the [*I/O -object]: - - socket.connect(server_endpoint); - -2. The [*I/O object] forwards the request to the [*io_context]. - -3. The [*io_context] calls on the [*operating system] to perform the connect -operation. - -4. The [*operating system] returns the result of the operation to the -[*io_context]. - -5. The [*io_context] translates any error resulting from the operation into an -object of type `boost::system::error_code`. An `error_code` may be compared with -specific values, or tested as a boolean (where a `false` result means that no -error occurred). The result is then forwarded back up to the [*I/O object]. - -6. The [*I/O object] throws an exception of type `boost::system::system_error` if the -operation failed. If the code to initiate the operation had instead been -written as: - - boost::system::error_code ec; - socket.connect(server_endpoint, ec); - -then the `error_code` variable `ec` would be set to the result of the -operation, and no exception would be thrown. - -When an asynchronous operation is used, a different sequence of events occurs. - -[$boost_asio/async_op1.png] - -1. [*Your program] initiates the connect operation by calling the [*I/O -object]: - - socket.async_connect(server_endpoint, your_completion_handler); - -where `your_completion_handler` is a function or function object with the -signature: - - void your_completion_handler(const boost::system::error_code& ec); - -The exact signature required depends on the asynchronous operation being -performed. The reference documentation indicates the appropriate form for each -operation. - -2. The [*I/O object] forwards the request to the [*io_context]. - -3. The [*io_context] signals to the [*operating system] that it should start an -asynchronous connect. - -Time passes. (In the synchronous case this wait would have been contained -entirely within the duration of the connect operation.) - -[$boost_asio/async_op2.png] - -4. The [*operating system] indicates that the connect operation has completed -by placing the result on a queue, ready to be picked up by the [*io_context]. - -5. [*Your program] must make a call to `io_context::run()` (or to one of the -similar [*io_context] member functions) in order for the result to be -retrieved. A call to `io_context::run()` blocks while there are unfinished -asynchronous operations, so you would typically call it as soon as you have -started your first asynchronous operation. - -6. While inside the call to `io_context::run()`, the [*io_context] dequeues the -result of the operation, translates it into an `error_code`, and then passes it -to [*your completion handler]. - -This is a simplified picture of how Boost.Asio operates. You will want to delve -further into the documentation if your needs are more advanced, such as -extending Boost.Asio to perform other types of asynchronous operations. - -[endsect] diff --git a/boost-asio/doc/overview/bsd_sockets.qbk b/boost-asio/doc/overview/bsd_sockets.qbk deleted file mode 100644 index efb986cb3..000000000 --- a/boost-asio/doc/overview/bsd_sockets.qbk +++ /dev/null @@ -1,270 +0,0 @@ -[/ - / Copyright (c) 2003-2018 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:bsd_sockets The BSD Socket API and Boost.Asio] - -The Boost.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. - -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 Boost.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 Boost.Asio: - -[table - [ - [BSD Socket API Elements] - [Equivalents in Boost.Asio] - ] - [ - [socket descriptor - `int` (POSIX) or `SOCKET` (Windows)] - [ For TCP: [link boost_asio.reference.ip__tcp.socket ip::tcp::socket], - [link boost_asio.reference.ip__tcp.acceptor ip::tcp::acceptor] - - For UDP: [link boost_asio.reference.ip__udp.socket ip::udp::socket] - - [link boost_asio.reference.basic_socket basic_socket], - [link boost_asio.reference.basic_stream_socket basic_stream_socket], - [link boost_asio.reference.basic_datagram_socket basic_datagram_socket], - [link boost_asio.reference.basic_raw_socket basic_raw_socket] ] - ] - [ - [`in_addr`, - `in6_addr`] - [ [link boost_asio.reference.ip__address ip::address], - [link boost_asio.reference.ip__address ip::address_v4], - [link boost_asio.reference.ip__address ip::address_v6] ] - ] - [ - [`sockaddr_in`, - `sockaddr_in6`] - [ For TCP: [link boost_asio.reference.ip__tcp.endpoint ip::tcp::endpoint] - - For UDP: [link boost_asio.reference.ip__udp.endpoint ip::udp::endpoint] - - [link boost_asio.reference.ip__basic_endpoint ip::basic_endpoint] ] - ] - [ - [`accept()`] - [ For TCP: [link boost_asio.reference.basic_socket_acceptor.accept ip::tcp::acceptor::accept()] - - [link boost_asio.reference.basic_socket_acceptor.accept basic_socket_acceptor::accept()] ] - ] - [ - [`bind()`] - [ For TCP: [link boost_asio.reference.basic_socket.bind ip::tcp::acceptor::bind()], - [link boost_asio.reference.basic_socket.bind ip::tcp::socket::bind()] - - For UDP: [link boost_asio.reference.basic_socket.bind ip::udp::socket::bind()] - - [link boost_asio.reference.basic_socket.bind basic_socket::bind()] ] - ] - [ - [`close()`] - [ For TCP: [link boost_asio.reference.basic_socket.close ip::tcp::acceptor::close()], - [link boost_asio.reference.basic_socket.close ip::tcp::socket::close()] - - For UDP: [link boost_asio.reference.basic_socket.close ip::udp::socket::close()] - - [link boost_asio.reference.basic_socket.close basic_socket::close()] ] - ] - [ - [`connect()`] - [ For TCP: [link boost_asio.reference.basic_socket.connect ip::tcp::socket::connect()] - - For UDP: [link boost_asio.reference.basic_socket.connect ip::udp::socket::connect()] - - [link boost_asio.reference.basic_socket.connect basic_socket::connect()] ] - ] - [ - [`getaddrinfo()`, - `gethostbyaddr()`, - `gethostbyname()`, - `getnameinfo()`, - `getservbyname()`, - `getservbyport()`] - [ For TCP: [link boost_asio.reference.ip__basic_resolver.resolve ip::tcp::resolver::resolve()], - [link boost_asio.reference.ip__basic_resolver.async_resolve ip::tcp::resolver::async_resolve()] - - For UDP: [link boost_asio.reference.ip__basic_resolver.resolve ip::udp::resolver::resolve()], - [link boost_asio.reference.ip__basic_resolver.async_resolve ip::udp::resolver::async_resolve()] - - [link boost_asio.reference.ip__basic_resolver.resolve ip::basic_resolver::resolve()], - [link boost_asio.reference.ip__basic_resolver.async_resolve ip::basic_resolver::async_resolve()] ] - ] - [ - [`gethostname()`] - [ [link boost_asio.reference.ip__host_name ip::host_name()] ] - ] - [ - [`getpeername()`] - [ For TCP: [link boost_asio.reference.basic_socket.remote_endpoint ip::tcp::socket::remote_endpoint()] - - For UDP: [link boost_asio.reference.basic_socket.remote_endpoint ip::udp::socket::remote_endpoint()] - - [link boost_asio.reference.basic_socket.remote_endpoint basic_socket::remote_endpoint()] ] - ] - [ - [`getsockname()`] - [ For TCP: [link boost_asio.reference.basic_socket.local_endpoint ip::tcp::acceptor::local_endpoint()], - [link boost_asio.reference.basic_socket.local_endpoint ip::tcp::socket::local_endpoint()] - - For UDP: [link boost_asio.reference.basic_socket.local_endpoint ip::udp::socket::local_endpoint()] - - [link boost_asio.reference.basic_socket.local_endpoint basic_socket::local_endpoint()] ] - ] - [ - [`getsockopt()`] - [ For TCP: [link boost_asio.reference.basic_socket.get_option ip::tcp::acceptor::get_option()], - [link boost_asio.reference.basic_socket.get_option ip::tcp::socket::get_option()] - - For UDP: [link boost_asio.reference.basic_socket.get_option ip::udp::socket::get_option()] - - [link boost_asio.reference.basic_socket.get_option basic_socket::get_option()] ] - ] - [ - [`inet_addr()`, - `inet_aton()`, - `inet_pton()`] - [ [link boost_asio.reference.ip__address.from_string ip::address::from_string()], - [link boost_asio.reference.ip__address.from_string ip::address_v4::from_string()], - [link boost_asio.reference.ip__address.from_string ip_address_v6::from_string()] ] - ] - [ - [`inet_ntoa()`, - `inet_ntop()`] - [ [link boost_asio.reference.ip__address.to_string ip::address::to_string()], - [link boost_asio.reference.ip__address.to_string ip::address_v4::to_string()], - [link boost_asio.reference.ip__address.to_string ip_address_v6::to_string()] ] - ] - [ - [`ioctl()`] - [ For TCP: [link boost_asio.reference.basic_socket.io_control ip::tcp::socket::io_control()] - - For UDP: [link boost_asio.reference.basic_socket.io_control ip::udp::socket::io_control()] - - [link boost_asio.reference.basic_socket.io_control basic_socket::io_control()] ] - ] - [ - [`listen()`] - [ For TCP: [link boost_asio.reference.basic_socket_acceptor.listen ip::tcp::acceptor::listen()] - - [link boost_asio.reference.basic_socket_acceptor.listen basic_socket_acceptor::listen()] ] - ] - [ - [`poll()`, - `select()`, - `pselect()`] - [ [link boost_asio.reference.io_context.run io_context::run()], - [link boost_asio.reference.io_context.run_one io_context::run_one()], - [link boost_asio.reference.io_context.poll io_context::poll()], - [link boost_asio.reference.io_context.poll_one io_context::poll_one()] - - Note: in conjunction with asynchronous operations. ] - ] - [ - [`readv()`, - `recv()`, - `read()`] - [ For TCP: [link boost_asio.reference.basic_stream_socket.read_some ip::tcp::socket::read_some()], - [link boost_asio.reference.basic_stream_socket.async_read_some ip::tcp::socket::async_read_some()], - [link boost_asio.reference.basic_stream_socket.receive ip::tcp::socket::receive()], - [link boost_asio.reference.basic_stream_socket.async_receive ip::tcp::socket::async_receive()] - - For UDP: [link boost_asio.reference.basic_datagram_socket.receive ip::udp::socket::receive()], - [link boost_asio.reference.basic_datagram_socket.async_receive ip::udp::socket::async_receive()] - - [link boost_asio.reference.basic_stream_socket.read_some basic_stream_socket::read_some()], - [link boost_asio.reference.basic_stream_socket.async_read_some basic_stream_socket::async_read_some()], - [link boost_asio.reference.basic_stream_socket.receive basic_stream_socket::receive()], - [link boost_asio.reference.basic_stream_socket.async_receive basic_stream_socket::async_receive()], - [link boost_asio.reference.basic_datagram_socket.receive basic_datagram_socket::receive()], - [link boost_asio.reference.basic_datagram_socket.async_receive basic_datagram_socket::async_receive()] ] - ] - [ - [`recvfrom()`] - [ For UDP: [link boost_asio.reference.basic_datagram_socket.receive_from ip::udp::socket::receive_from()], - [link boost_asio.reference.basic_datagram_socket.async_receive_from ip::udp::socket::async_receive_from()] - - [link boost_asio.reference.basic_datagram_socket.receive_from basic_datagram_socket::receive_from()], - [link boost_asio.reference.basic_datagram_socket.async_receive_from basic_datagram_socket::async_receive_from()] ] - ] - [ - [`send()`, - `write()`, - `writev()`] - [ For TCP: [link boost_asio.reference.basic_stream_socket.write_some ip::tcp::socket::write_some()], - [link boost_asio.reference.basic_stream_socket.async_write_some ip::tcp::socket::async_write_some()], - [link boost_asio.reference.basic_stream_socket.send ip::tcp::socket::send()], - [link boost_asio.reference.basic_stream_socket.async_send ip::tcp::socket::async_send()] - - For UDP: [link boost_asio.reference.basic_datagram_socket.send ip::udp::socket::send()], - [link boost_asio.reference.basic_datagram_socket.async_send ip::udp::socket::async_send()] - - [link boost_asio.reference.basic_stream_socket.write_some basic_stream_socket::write_some()], - [link boost_asio.reference.basic_stream_socket.async_write_some basic_stream_socket::async_write_some()], - [link boost_asio.reference.basic_stream_socket.send basic_stream_socket::send()], - [link boost_asio.reference.basic_stream_socket.async_send basic_stream_socket::async_send()], - [link boost_asio.reference.basic_datagram_socket.send basic_datagram_socket::send()], - [link boost_asio.reference.basic_datagram_socket.async_send basic_datagram_socket::async_send()] ] - ] - [ - [`sendto()`] - [ For UDP: [link boost_asio.reference.basic_datagram_socket.send_to ip::udp::socket::send_to()], - [link boost_asio.reference.basic_datagram_socket.async_send_to ip::udp::socket::async_send_to()] - - [link boost_asio.reference.basic_datagram_socket.send_to basic_datagram_socket::send_to()], - [link boost_asio.reference.basic_datagram_socket.async_send_to basic_datagram_socket::async_send_to()] ] - ] - [ - [`setsockopt()`] - [ For TCP: [link boost_asio.reference.basic_socket.set_option ip::tcp::acceptor::set_option()], - [link boost_asio.reference.basic_socket.set_option ip::tcp::socket::set_option()] - - For UDP: [link boost_asio.reference.basic_socket.set_option ip::udp::socket::set_option()] - - [link boost_asio.reference.basic_socket.set_option basic_socket::set_option()] ] - ] - [ - [`shutdown()`] - [ For TCP: [link boost_asio.reference.basic_socket.shutdown ip::tcp::socket::shutdown()] - - For UDP: [link boost_asio.reference.basic_socket.shutdown ip::udp::socket::shutdown()] - - [link boost_asio.reference.basic_socket.shutdown basic_socket::shutdown()] ] - ] - [ - [`sockatmark()`] - [ For TCP: [link boost_asio.reference.basic_socket.at_mark ip::tcp::socket::at_mark()] - - [link boost_asio.reference.basic_socket.at_mark basic_socket::at_mark()] ] - ] - [ - [`socket()`] - [ For TCP: [link boost_asio.reference.basic_socket.open ip::tcp::acceptor::open()], - [link boost_asio.reference.basic_socket.open ip::tcp::socket::open()] - - For UDP: [link boost_asio.reference.basic_socket.open ip::udp::socket::open()] - - [link boost_asio.reference.basic_socket.open basic_socket::open()] ] - ] - [ - [`socketpair()`] - [ [link boost_asio.reference.local__connect_pair local::connect_pair()] - - Note: POSIX operating systems only. ] - ] -] - -[endsect] diff --git a/boost-asio/doc/overview/buffers.qbk b/boost-asio/doc/overview/buffers.qbk deleted file mode 100644 index 6ea93a8a4..000000000 --- a/boost-asio/doc/overview/buffers.qbk +++ /dev/null @@ -1,163 +0,0 @@ -[/ - / Copyright (c) 2003-2018 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:buffers Buffers] - -Fundamentally, I/O involves the transfer of data to and from contiguous regions -of memory, called buffers. These buffers can be simply expressed as a tuple -consisting of a pointer and a size in bytes. However, to allow the development -of efficient network applications, Boost.Asio includes support for scatter-gather -operations. These operations involve one or more buffers: - -* A scatter-read receives data into multiple buffers. -* A gather-write transmits multiple buffers. - -Therefore we require an abstraction to represent a collection of buffers. The -approach used in Boost.Asio is to define a type (actually two types) to -represent a single buffer. These can be stored in a container, which may be -passed to the scatter-gather operations. - -In addition to specifying buffers as a pointer and size in bytes, Boost.Asio makes a -distinction between modifiable memory (called mutable) and non-modifiable -memory (where the latter is created from the storage for a const-qualified -variable). These two types could therefore be defined as follows: - - typedef std::pair mutable_buffer; - typedef std::pair const_buffer; - -Here, a mutable_buffer would be convertible to a const_buffer, but conversion -in the opposite direction is not valid. - -However, Boost.Asio does not use the above definitions as-is, but instead defines two -classes: `mutable_buffer` and `const_buffer`. The goal of these is to provide -an opaque representation of contiguous memory, where: - -* Types behave as std::pair would in conversions. That is, a `mutable_buffer` is - convertible to a `const_buffer`, but the opposite conversion is disallowed. - -* There is protection against buffer overruns. Given a buffer instance, a user - can only create another buffer representing the same range of memory or a - sub-range of it. To provide further safety, the library also includes - mechanisms for automatically determining the size of a buffer from an array, - `boost::array` or `std::vector` of POD elements, or from a `std::string`. - -* The underlying memory is explicitly accessed using the `data()` member - function. In general an application should never need to do this, but it is - required by the library implementation to pass the raw memory to the - underlying operating system functions. - -Finally, multiple buffers can be passed to scatter-gather operations (such as -[link boost_asio.reference.read read()] or [link boost_asio.reference.write write()]) by -putting the buffer objects into a container. The `MutableBufferSequence` and -`ConstBufferSequence` concepts have been defined so that containers such as -`std::vector`, `std::list`, `std::vector` or `boost::array` can be used. - -[heading Streambuf for Integration with Iostreams] - -The class `boost::asio::basic_streambuf` is derived from `std::basic_streambuf` to -associate the input sequence and output sequence with one or more objects of -some character array type, whose elements store arbitrary values. These -character array objects are internal to the streambuf object, but direct access -to the array elements is provided to permit them to be used with I/O -operations, such as the send or receive operations of a socket: - -* The input sequence of the streambuf is accessible via the [link - boost_asio.reference.basic_streambuf.data data()] member function. The return type - of this function meets the `ConstBufferSequence` requirements. - -* The output sequence of the streambuf is accessible via the [link - boost_asio.reference.basic_streambuf.prepare prepare()] member function. The return - type of this function meets the `MutableBufferSequence` requirements. - -* Data is transferred from the front of the output sequence to the back of the - input sequence by calling the [link boost_asio.reference.basic_streambuf.commit - commit()] member function. - -* Data is removed from the front of the input sequence by calling the [link - boost_asio.reference.basic_streambuf.consume consume()] member function. - -The streambuf constructor accepts a `size_t` argument specifying the maximum of -the sum of the sizes of the input sequence and output sequence. Any operation -that would, if successful, grow the internal data beyond this limit will throw -a `std::length_error` exception. - -[heading Bytewise Traversal of Buffer Sequences] - -The `buffers_iterator<>` class template allows buffer sequences (i.e. types -meeting `MutableBufferSequence` or `ConstBufferSequence` requirements) to be -traversed as though they were a contiguous sequence of bytes. Helper functions -called buffers_begin() and buffers_end() are also provided, where the -buffers_iterator<> template parameter is automatically deduced. - -As an example, to read a single line from a socket and into a `std::string`, -you may write: - - boost::asio::streambuf sb; - ... - std::size_t n = boost::asio::read_until(sock, sb, '\n'); - boost::asio::streambuf::const_buffers_type bufs = sb.data(); - std::string line( - boost::asio::buffers_begin(bufs), - boost::asio::buffers_begin(bufs) + n); - -[heading Buffer Debugging] - -Some standard library implementations, such as the one that ships with -Microsoft Visual C++ 8.0 and later, provide a feature called iterator -debugging. What this means is that the validity of iterators is checked at -runtime. If a program tries to use an iterator that has been invalidated, an -assertion will be triggered. For example: - - std::vector v(1) - std::vector::iterator i = v.begin(); - v.clear(); // invalidates iterators - *i = 0; // assertion! - -Boost.Asio takes advantage of this feature to add buffer debugging. Consider the -following code: - - void dont_do_this() - { - std::string msg = "Hello, world!"; - boost::asio::async_write(sock, boost::asio::buffer(msg), my_handler); - } - -When you call an asynchronous read or write you need to ensure that the buffers -for the operation are valid until the completion handler is called. In the -above example, the buffer is the `std::string` variable `msg`. This variable is -on the stack, and so it goes out of scope before the asynchronous operation -completes. If you're lucky then the application will crash, but random failures -are more likely. - -When buffer debugging is enabled, Boost.Asio stores an iterator into the string until -the asynchronous operation completes, and then dereferences it to check its -validity. In the above example you would observe an assertion failure just -before Boost.Asio tries to call the completion handler. - -This feature is automatically made available for Microsoft Visual Studio 8.0 or -later and for GCC when `_GLIBCXX_DEBUG` is defined. There is a performance cost -to this checking, so buffer debugging is only enabled in debug builds. For -other compilers it may be enabled by defining `BOOST_ASIO_ENABLE_BUFFER_DEBUGGING`. -It can also be explicitly disabled by defining `BOOST_ASIO_DISABLE_BUFFER_DEBUGGING`. - -[heading See Also] - -[link boost_asio.reference.buffer buffer], -[link boost_asio.reference.buffers_begin buffers_begin], -[link boost_asio.reference.buffers_end buffers_end], -[link boost_asio.reference.buffers_iterator buffers_iterator], -[link boost_asio.reference.const_buffer const_buffer], -[link boost_asio.reference.const_buffers_1 const_buffers_1], -[link boost_asio.reference.mutable_buffer mutable_buffer], -[link boost_asio.reference.mutable_buffers_1 mutable_buffers_1], -[link boost_asio.reference.streambuf streambuf], -[link boost_asio.reference.ConstBufferSequence ConstBufferSequence], -[link boost_asio.reference.MutableBufferSequence MutableBufferSequence], -[link boost_asio.examples.cpp03_examples.buffers buffers example (C++03)], -[link boost_asio.examples.cpp11_examples.buffers buffers example (c++11)]. - -[endsect] diff --git a/boost-asio/doc/overview/concurrency_hint.qbk b/boost-asio/doc/overview/concurrency_hint.qbk deleted file mode 100644 index fe1d9db16..000000000 --- a/boost-asio/doc/overview/concurrency_hint.qbk +++ /dev/null @@ -1,88 +0,0 @@ -[/ - / Copyright (c) 2003-2018 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:concurrency_hint Concurrency Hints] - -The [link boost_asio.reference.io_context.io_context `io_context` constructor] -allows programs to specify a concurrency hint. This is a suggestion to the -`io_context` implementation as to the number of active threads that should be -used for running completion handlers. - -When the Windows I/O completion port backend is in use, this value is passed -to [^CreateIoCompletionPort]. - -When a reactor-based backend is used, the implementation recognises the -following special concurrency hint values: - -[table - [[Value][Description]] - [ - [`1`] - [ - The implementation assumes that the `io_context` will be run from a - single thread, and applies several optimisations based on this - assumption. - - For example, when a handler is posted from within another handler, the - new handler is added to a fast thread-local queue (with the consequence - that the new handler is held back until the currently executing handler - finishes). - ] - ] - [ - [`BOOST_ASIO_CONCURRENCY_HINT_UNSAFE`] - [ - This special concurrency hint disables locking in both the scheduler and - reactor I/O. This hint has the following restrictions: - - [mdash] Care must be taken to ensure that all operations on the - `io_context` and any of its associated I/O objects (such as sockets and - timers) occur in only one thread at a time. - - [mdash] Asynchronous resolve operations fail with `operation_not_supported`. - - [mdash] If a `signal_set` is used with the `io_context`, `signal_set` - objects cannot be used with any other io_context in the program. - ] - ] - [ - [`BOOST_ASIO_CONCURRENCY_HINT_UNSAFE_IO`] - [ - This special concurrency hint disables locking in the reactor I/O. This - hint has the following restrictions: - - [mdash] Care must be taken to ensure that run functions on the - `io_context`, and all operations on the context's associated I/O objects - (such as sockets and timers), occur in only one thread at a time. - ] - ] - [ - [`BOOST_ASIO_CONCURRENCY_HINT_SAFE`] - [ - The default. The `io_context` provides full thread safety, and distinct - I/O objects may be used from any thread. - ] - ] -] - -[teletype] -The concurrency hint used by default-constructed `io_context` objects can be -overridden at compile time by defining the `BOOST_ASIO_CONCURRENCY_HINT_DEFAULT` -macro. For example, specifying - - -DBOOST_ASIO_CONCURRENCY_HINT_DEFAULT=1 - -on the compiler command line means that a concurrency hint of `1` is used for -all default-constructed `io_context` objects in the program. Similarly, the -concurrency hint used by `io_context` objects constructed with `1` can be -overridden by defining `BOOST_ASIO_CONCURRENCY_HINT_1`. For example, passing - - -DBOOST_ASIO_CONCURRENCY_HINT_1=BOOST_ASIO_CONCURRENCY_HINT_UNSAFE - -to the compiler will disable thread safety for all of these objects. - -[endsect] diff --git a/boost-asio/doc/overview/coroutine.qbk b/boost-asio/doc/overview/coroutine.qbk deleted file mode 100644 index 99f3b171b..000000000 --- a/boost-asio/doc/overview/coroutine.qbk +++ /dev/null @@ -1,51 +0,0 @@ -[/ - / Copyright (c) 2003-2018 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:coroutine Stackless Coroutines] - -The [link boost_asio.reference.coroutine `coroutine`] class provides support for -stackless coroutines. Stackless coroutines enable programs to implement -asynchronous logic in a synchronous manner, with minimal overhead, as shown in -the following example: - - struct session : boost::asio::coroutine - { - boost::shared_ptr socket_; - boost::shared_ptr > buffer_; - - session(boost::shared_ptr socket) - : socket_(socket), - buffer_(new std::vector(1024)) - { - } - - void operator()(boost::system::error_code ec = boost::system::error_code(), std::size_t n = 0) - { - if (!ec) reenter (this) - { - for (;;) - { - yield socket_->async_read_some(boost::asio::buffer(*buffer_), *this); - yield boost::asio::async_write(*socket_, boost::asio::buffer(*buffer_, n), *this); - } - } - } - }; - -The `coroutine` class is used in conjunction with the pseudo-keywords -`reenter`, `yield` and `fork`. These are preprocessor macros, and are -implemented in terms of a `switch` statement using a technique similar to -Duff's Device. The [link boost_asio.reference.coroutine `coroutine`] class's -documentation provides a complete description of these pseudo-keywords. - -[heading See Also] - -[link boost_asio.reference.coroutine coroutine], -[link boost_asio.examples.cpp03_examples.http_server_4 HTTP Server 4 example], -[link boost_asio.overview.core.spawn Stackful Coroutines]. - -[endsect] diff --git a/boost-asio/doc/overview/coroutines_ts.qbk b/boost-asio/doc/overview/coroutines_ts.qbk deleted file mode 100644 index a52735423..000000000 --- a/boost-asio/doc/overview/coroutines_ts.qbk +++ /dev/null @@ -1,107 +0,0 @@ -[/ - / Copyright (c) 2003-2018 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:coroutines_ts Coroutines TS Support (experimental)] - -(Note: "Experimental" means that this interface is provided to gather feedback -and may change in subsequent Asio releases.) - -Experimental support for the Coroutines TS is provided via the [link -boost_asio.reference.experimental__co_spawn `experimental::co_spawn()`] -function. This `co_spawn()` function enables programs to implement asynchronous -logic in a synchronous manner, in conjunction with the `co_await` keyword, as -shown in the following example: - - boost::asio::experimental::co_spawn(executor, - [socket = std::move(socket)]() mutable - { - return echo(std::move(socket)); - }, - boost::asio::experimental::detached); - - // ... - - boost::asio::experimental::awaitable echo(tcp::socket socket) - { - auto token = co_await boost::asio::experimental::this_coro::token(); - - try - { - char data[1024]; - for (;;) - { - std::size_t n = co_await socket.async_read_some(boost::asio::buffer(data), token); - co_await async_write(socket, boost::asio::buffer(data, n), token); - } - } - catch (std::exception& e) - { - std::printf("echo Exception: %s\n", e.what()); - } - } - -The first argument to `co_spawn()` is an [link boost_asio.reference.Executor1 -executor] that determines the context in which the coroutine is permitted to -execute. For example, a server's per-client object may consist of multiple -coroutines; they should all run on the same `strand` so that no explicit -synchronisation is required. - -The second argument is a nullary function object that returns a [link -boost_asio.reference.experimental__awaitable `boost::asio::awaitable`], -where `R` is the type of return value produced by the coroutine. In the above -example, the coroutine returns `void`. - -The third argument is a completion token, and this is used by `co_spawn()` to -produce a completion handler with signature `void(std::exception_ptr, R)`. This -completion handler is invoked with the result of the coroutine once it has -finished. In the above example we pass a completion token type, [link -boost_asio.reference.experimental__detached -`boost::asio::experimental::detached`], which is used to explicitly ignore the -result of an asynchronous operation. - -In this example the body of the coroutine is implemented in the `echo` -function. This function first obtains a completion token that represents the -current coroutine: - - auto token = co_await boost::asio::experimental::this_coro::token(); - -When this completion token is passed to an asynchronous operation, the -operation's initiating function returns an `awaitable` that may be used with -the `co_await` keyword: - - std::size_t n = co_await socket.async_read_some(boost::asio::buffer(data), token); - -Where an asynchronous operation's handler signature has the form: - - void handler(boost::system::error_code ec, result_type result); - -the resulting type of the `co_await` expression is `result_type`. In the -`async_read_some` example above, this is `size_t`. If the asynchronous -operation fails, the `error_code` is converted into a `system_error` exception -and thrown. - -Where a handler signature has the form: - - void handler(boost::system::error_code ec); - -the `co_await` expression produces a `void` result. As above, an error is -passed back to the coroutine as a `system_error` exception. - -[heading See Also] - -[link boost_asio.reference.experimental__co_spawn experimental::co_spawn], -[link boost_asio.reference.experimental__detached experimental::detached], -[link boost_asio.reference.experimental__redirect_error experimental::redirect_error], -[link boost_asio.reference.experimental__awaitable experimental::awaitable], -[link boost_asio.reference.experimental__await_token experimental::await_token], -[link boost_asio.reference.experimental__this_coro__executor experimental::this_coro::executor], -[link boost_asio.reference.experimental__this_coro__token experimental::this_coro::token], -[link boost_asio.examples.cpp17_examples.coroutines_ts_support Coroutines TS examples], -[link boost_asio.overview.core.spawn Stackful Coroutines], -[link boost_asio.overview.core.coroutine Stackless Coroutines]. - -[endsect] diff --git a/boost-asio/doc/overview/cpp2011.qbk b/boost-asio/doc/overview/cpp2011.qbk deleted file mode 100644 index 60eb2d091..000000000 --- a/boost-asio/doc/overview/cpp2011.qbk +++ /dev/null @@ -1,253 +0,0 @@ -[/ - / Copyright (c) 2003-2018 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:cpp2011 C++ 2011 Support] - - -[link boost_asio.overview.cpp2011.move_objects Movable I/O Objects] - -[link boost_asio.overview.cpp2011.move_handlers Movable Handlers] - -[link boost_asio.overview.cpp2011.variadic Variadic Templates] - -[link boost_asio.overview.cpp2011.array Array Container] - -[link boost_asio.overview.cpp2011.atomic Atomics] - -[link boost_asio.overview.cpp2011.shared_ptr Shared Pointers] - -[link boost_asio.overview.cpp2011.chrono Chrono] - -[link boost_asio.overview.cpp2011.futures Futures] - - -[section:move_objects Movable I/O Objects] - -When move support is available (via rvalue references), Boost.Asio allows move -construction and assignment of sockets, serial ports, POSIX descriptors and -Windows handles. - -Move support allows you to write code like: - - tcp::socket make_socket(io_context& i) - { - tcp::socket s(i); - ... - std::move(s); - } - -or: - - class connection : public enable_shared_from_this - { - private: - tcp::socket socket_; - ... - public: - connection(tcp::socket&& s) : socket_(std::move(s)) {} - ... - }; - - ... - - class server - { - private: - tcp::acceptor acceptor_; - ... - void handle_accept(error_code ec, tcp::socket socket) - { - if (!ec) - std::make_shared(std::move(socket))->go(); - acceptor_.async_accept(...); - } - ... - }; - -as well as: - - std::vector sockets; - sockets.push_back(tcp::socket(...)); - -A word of warning: There is nothing stopping you from moving these objects -while there are pending asynchronous operations, but it is unlikely to be a -good idea to do so. In particular, composed operations like [link -boost_asio.reference.async_read async_read()] store a reference to the stream object. -Moving during the composed operation means that the composed operation may -attempt to access a moved-from object. - -Move support is automatically enabled for [^g++] 4.5 and later, when the -[^-std=c++0x] or [^-std=gnu++0x] compiler options are used. It may be disabled -by defining `BOOST_ASIO_DISABLE_MOVE`, or explicitly enabled for other compilers by -defining `BOOST_ASIO_HAS_MOVE`. Note that these macros also affect the availability -of [link boost_asio.overview.cpp2011.move_handlers movable handlers]. - -[endsect] - -[section:move_handlers Movable Handlers] - -As an optimisation, user-defined completion handlers may provide move -constructors, and Boost.Asio's implementation will use a handler's move constructor -in preference to its copy constructor. In certain circumstances, Boost.Asio may be -able to eliminate all calls to a handler's copy constructor. However, handler -types are still required to be copy constructible. - -When move support is enabled, asynchronous that are documented as follows: - - template - void async_XYZ(..., Handler handler); - -are actually declared as: - - template - void async_XYZ(..., Handler&& handler); - -The handler argument is perfectly forwarded and the move construction occurs -within the body of `async_XYZ()`. This ensures that all other function -arguments are evaluated prior to the move. This is critical when the other -arguments to `async_XYZ()` are members of the handler. For example: - - struct my_operation - { - shared_ptr socket; - shared_ptr> buffer; - ... - void operator(error_code ec, size_t length) - { - ... - socket->async_read_some(boost::asio::buffer(*buffer), std::move(*this)); - ... - } - }; - -Move support is automatically enabled for [^g++] 4.5 and later, when the -[^-std=c++0x] or [^-std=gnu++0x] compiler options are used. It may be disabled -by defining `BOOST_ASIO_DISABLE_MOVE`, or explicitly enabled for other compilers by -defining `BOOST_ASIO_HAS_MOVE`. Note that these macros also affect the availability -of [link boost_asio.overview.cpp2011.move_objects movable I/O objects]. - -[endsect] - -[section:variadic Variadic Templates] - -When supported by a compiler, Boost.Asio can use variadic templates to implement the -[link boost_asio.reference.basic_socket_streambuf.connect -basic_socket_streambuf::connect()] and [link -boost_asio.reference.basic_socket_iostream.connect basic_socket_iostream::connect()] -functions. - -Support for variadic templates is automatically enabled for [^g++] 4.3 and -later, when the [^-std=c++0x] or [^-std=gnu++0x] compiler options are used. It -may be disabled by defining `BOOST_ASIO_DISABLE_VARIADIC_TEMPLATES`, or explicitly -enabled for other compilers by defining `BOOST_ASIO_HAS_VARIADIC_TEMPLATES`. - -[endsect] - -[section:array Array Container] - -Where the standard library provides `std::array<>`, Boost.Asio: - -* Provides overloads for the [link boost_asio.reference.buffer buffer()] function. - -* Uses it in preference to `boost::array<>` for the - [link boost_asio.reference.ip__address_v4.bytes_type ip::address_v4::bytes_type] and - [link boost_asio.reference.ip__address_v6.bytes_type ip::address_v6::bytes_type] - types. - -* Uses it in preference to `boost::array<>` where a fixed size array type is - needed in the implementation. - -Support for `std::array<>` is automatically enabled for [^g++] 4.3 and later, -when the [^-std=c++0x] or [^-std=gnu++0x] compiler options are used, as well as -for Microsoft Visual C++ 10. It may be disabled by defining -`BOOST_ASIO_DISABLE_STD_ARRAY`, or explicitly enabled for other compilers by -defining `BOOST_ASIO_HAS_STD_ARRAY`. - -[endsect] - -[section:atomic Atomics] - -Boost.Asio's implementation can use `std::atomic<>` in preference to -`boost::detail::atomic_count`. - -Support for the standard atomic integer template is automatically enabled for -[^g++] 4.5 and later, when the [^-std=c++0x] or [^-std=gnu++0x] compiler -options are used. It may be disabled by defining `BOOST_ASIO_DISABLE_STD_ATOMIC`, or -explicitly enabled for other compilers by defining `BOOST_ASIO_HAS_STD_ATOMIC`. - -[endsect] - -[section:shared_ptr Shared Pointers] - -Boost.Asio's implementation can use `std::shared_ptr<>` and `std::weak_ptr<>` in -preference to the Boost equivalents. - -Support for the standard smart pointers is automatically enabled for [^g++] 4.3 -and later, when the [^-std=c++0x] or [^-std=gnu++0x] compiler options are used, -as well as for Microsoft Visual C++ 10. It may be disabled by defining -`BOOST_ASIO_DISABLE_STD_SHARED_PTR`, or explicitly enabled for other compilers by -defining `BOOST_ASIO_HAS_STD_SHARED_PTR`. - -[endsect] - -[section:chrono Chrono] - -Boost.Asio provides timers based on the `std::chrono` facilities via the [link -boost_asio.reference.basic_waitable_timer basic_waitable_timer] class template. -The typedefs [link boost_asio.reference.system_timer system_timer], [link -boost_asio.reference.steady_timer steady_timer] and [link -boost_asio.reference.high_resolution_timer high_resolution_timer] utilise the -standard clocks `system_clock`, `steady_clock` and `high_resolution_clock` -respectively. - -Support for the `std::chrono` facilities is automatically enabled for [^g++] -4.6 and later, when the [^-std=c++0x] or [^-std=gnu++0x] compiler options are -used. (Note that, for [^g++], the draft-standard `monotonic_clock` is used in -place of `steady_clock`.) Support may be disabled by defining -`BOOST_ASIO_DISABLE_STD_CHRONO`, or explicitly enabled for other compilers by -defining `BOOST_ASIO_HAS_STD_CHRONO`. - -When standard `chrono` is unavailable, Boost.Asio will otherwise use the Boost.Chrono -library. The [link boost_asio.reference.basic_waitable_timer basic_waitable_timer] -class template may be used with either. - -[endsect] - -[section:futures Futures] - -The `boost::asio::use_future` special value provides first-class support for returning a -C++11 `std::future` from an asynchronous operation's initiating function. - -To use `boost::asio::use_future`, pass it to an asynchronous operation instead of -a normal completion handler. For example: - - std::future length = - my_socket.async_read_some(my_buffer, boost::asio::use_future); - -Where a handler signature has the form: - - void handler(boost::system::error_code ec, result_type result); - -the initiating function returns a `std::future` templated on `result_type`. -In the above example, this is `std::size_t`. If the asynchronous operation -fails, the `error_code` is converted into a `system_error` exception and -passed back to the caller through the future. - -Where a handler signature has the form: - - void handler(boost::system::error_code ec); - -the initiating function returns `std::future`. As above, an error -is passed back in the future as a `system_error` exception. - -[link boost_asio.reference.use_future use_future], -[link boost_asio.reference.use_future_t use_future_t], -[link boost_asio.examples.cpp11_examples.futures Futures example (C++11)]. - -[endsect] - -[endsect] diff --git a/boost-asio/doc/overview/handler_tracking.qbk b/boost-asio/doc/overview/handler_tracking.qbk deleted file mode 100644 index 85c4eae83..000000000 --- a/boost-asio/doc/overview/handler_tracking.qbk +++ /dev/null @@ -1,220 +0,0 @@ -[/ - / Copyright (c) 2003-2018 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:handler_tracking Handler Tracking] - -To aid in debugging asynchronous programs, Boost.Asio provides support for handler -tracking. When enabled by defining `BOOST_ASIO_ENABLE_HANDLER_TRACKING`, Boost.Asio -writes debugging output to the standard error stream. The output records -asynchronous operations and the relationships between their handlers. - -[teletype] -This feature is useful when debugging and you need to know how your -asynchronous operations are chained together, or what the pending asynchronous -operations are. As an illustration, here is the output when you run the HTTP -Server example, handle a single request, then shut down via Ctrl+C: - - @asio|1512254357.979980|0*1|signal_set@0x7ffeaaaa20d8.async_wait - @asio|1512254357.980127|0*2|socket@0x7ffeaaaa20f8.async_accept - @asio|1512254357.980150|.2|non_blocking_accept,ec=asio.system:11 - @asio|1512254357.980162|0|resolver@0x7ffeaaaa1fd8.cancel - @asio|1512254368.457147|.2|non_blocking_accept,ec=system:0 - @asio|1512254368.457193|>2|ec=system:0 - @asio|1512254368.457219|2*3|socket@0x55cf39f0a238.async_receive - @asio|1512254368.457244|.3|non_blocking_recv,ec=system:0,bytes_transferred=141 - @asio|1512254368.457275|2*4|socket@0x7ffeaaaa20f8.async_accept - @asio|1512254368.457293|.4|non_blocking_accept,ec=asio.system:11 - @asio|1512254368.457301|<2| - @asio|1512254368.457310|>3|ec=system:0,bytes_transferred=141 - @asio|1512254368.457441|3*5|socket@0x55cf39f0a238.async_send - @asio|1512254368.457502|.5|non_blocking_send,ec=system:0,bytes_transferred=156 - @asio|1512254368.457511|<3| - @asio|1512254368.457519|>5|ec=system:0,bytes_transferred=156 - @asio|1512254368.457544|5|socket@0x55cf39f0a238.close - @asio|1512254368.457559|<5| - @asio|1512254371.385106|>1|ec=system:0,signal_number=2 - @asio|1512254371.385130|1|socket@0x7ffeaaaa20f8.close - @asio|1512254371.385163|<1| - @asio|1512254371.385175|>4|ec=asio.system:125 - @asio|1512254371.385182|<4| - @asio|1512254371.385202|0|signal_set@0x7ffeaaaa20d8.cancel - -Each line is of the form: - - ||| - -The `` is always `@asio`, and is used to identify and extract the handler -tracking messages from the program output. - -The `` is seconds and microseconds from 1 Jan 1970 UTC. - -The `` takes one of the following forms: - -[variablelist - [ - [>n] - [The program entered the handler number `n`. The `` shows the - arguments to the handler.] - ] - [ - [` shows what asynchronous operation - was started.] - ] - [ - [n] - [The handler number `n` performed some other operation. The `` - shows what function was called. Currently only `close()` and `cancel()` - operations are logged, as these may affect the state of pending - asynchronous operations.] - ] - [ - [.n] - [The implementation performed a system call as part of the asynchronous - operation for which handler number `n` is the completion handler. The - `` shows what function was called and its results. These - tracking events are only emitted when using a reactor-based - implementation.] - ] -] - -Where the `` shows a synchronous or asynchronous operation, the -format is `@.`. For handler entry, it shows a -comma-separated list of arguments and their values. - -As shown above, Each handler is assigned a numeric identifier. Where the -handler tracking output shows a handler number of 0, it means that the action -was performed outside of any handler. - -[heading Visual Representations] - -The handler tracking output may be post-processed using the included -[^handlerviz.pl] tool to create a visual representation of the handlers -(requires the GraphViz tool [^dot]). -[c++] - -[heading Custom Tracking] - -Handling tracking may be customised by defining the -`BOOST_ASIO_CUSTOM_HANDLER_TRACKING` macro to the name of a header file -(enclosed in `""` or `<>`). This header file must implement the following -preprocessor macros: - -[table - [[Macro] [Description]] - [ - [`BOOST_ASIO_INHERIT_TRACKED_HANDLER`] - [Specifies a base class for classes that implement asynchronous operations. - When used, the macro immediately follows the class name, so it must have - the form `: public my_class`.] - ] - [ - [`BOOST_ASIO_ALSO_INHERIT_TRACKED_HANDLER`] - [Specifies a base class for classes that implement asynchronous operations. - When used, the macro follows other base classes, so it must have the form - `, public my_class`.] - ] - [ - [`BOOST_ASIO_HANDLER_TRACKING_INIT(args)`] - [An expression that is used to initialise the tracking mechanism.] - ] - [ - [`BOOST_ASIO_HANDLER_CREATION(args)`] - [An expression that is called on creation of an asynchronous operation. - `args` is a parenthesised function argument list containing the owning - execution context, the tracked handler, the name of the object type, a - pointer to the object, the object's native handle, and the operation name.] - ] - [ - [`BOOST_ASIO_HANDLER_COMPLETION(args)`] - [An expression that is called on completion of an asynchronous operation. - `args` is a parenthesised function argument list containing the tracked - handler.] - ] - [ - [`BOOST_ASIO_HANDLER_INVOCATION_BEGIN(args)`] - [An expression that is called immediately before a completion handler is - invoked. `args` is a parenthesised function argument list containing the - arguments to the completion handler.] - ] - [ - [`BOOST_ASIO_HANDLER_INVOCATION_END`] - [An expression that is called immediately after a completion handler is - invoked.] - ] - [ - [`BOOST_ASIO_HANDLER_OPERATION(args)`] - [An expression that is called when some synchronous object operation is - called (such as `close()` or `cancel()`). `args` is a parenthesised - function argument list containing the owning execution context, the name - of the object type, a pointer to the object, the object's native handle, - and the operation name.] - ] - [ - [`BOOST_ASIO_HANDLER_REACTOR_REGISTRATION(args)`] - [An expression that is called when an object is registered with the - reactor. `args` is a parenthesised function argument list containing the - owning execution context, the object's native handle, and a unique - registration key.] - ] - [ - [`BOOST_ASIO_HANDLER_REACTOR_DEREGISTRATION(args)`] - [An expression that is called when an object is deregistered from the - reactor. `args` is a parenthesised function argument list containing the - owning execution context, the object's native handle, and a unique - registration key.] - ] - [ - [`BOOST_ASIO_HANDLER_REACTOR_READ_EVENT`] - [A bitmask constant used to identify reactor read readiness events.] - ] - [ - [`BOOST_ASIO_HANDLER_REACTOR_WRITE_EVENT`] - [A bitmask constant used to identify reactor write readiness events.] - ] - [ - [`BOOST_ASIO_HANDLER_REACTOR_ERROR_EVENT`] - [A bitmask constant used to identify reactor error readiness events.] - ] - [ - [`BOOST_ASIO_HANDLER_REACTOR_EVENTS(args)`] - [An expression that is called when an object registered with the reactor - becomes ready. `args` is a parenthesised function argument list containing - the owning execution context, the unique registration key, and a bitmask of - the ready events.] - ] - [ - [`BOOST_ASIO_HANDLER_REACTOR_OPERATION(args)`] - [An expression that is called when the implementation performs a system - call as part of a reactor-based asynchronous operation. `args` is a - parenthesised function argument list containing the tracked handler, the - operation name, the error code produced by the operation, and (optionally) - the number of bytes transferred.] - ] -] - -[heading See Also] - -[link boost_asio.examples.cpp11_examples.handler_tracking Custom handler tracking -example]. - -[endsect] diff --git a/boost-asio/doc/overview/implementation.qbk b/boost-asio/doc/overview/implementation.qbk deleted file mode 100644 index d73810a9e..000000000 --- a/boost-asio/doc/overview/implementation.qbk +++ /dev/null @@ -1,305 +0,0 @@ -[/ - / Copyright (c) 2003-2018 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:implementation Platform-Specific Implementation Notes] - -This section lists platform-specific implementation details, such as the -default demultiplexing mechanism, the number of threads created internally, and -when threads are created. - - -[heading Linux Kernel 2.4] - -Demultiplexing mechanism: - -* Uses `select` for demultiplexing. This means that the number of file -descriptors in the process cannot be permitted to exceed `FD_SETSIZE`. - -Threads: - -* Demultiplexing using `select` is performed in one of the threads that calls -`io_context::run()`, `io_context::run_one()`, `io_context::poll()` or -`io_context::poll_one()`. - -* An additional thread per `io_context` is used to emulate asynchronous host -resolution. This thread is created on the first call to either -`ip::tcp::resolver::async_resolve()` or `ip::udp::resolver::async_resolve()`. - -Scatter-Gather: - -* At most `min(64,IOV_MAX)` buffers may be transferred in a single operation. - -[heading Linux Kernel 2.6] - -Demultiplexing mechanism: - -* Uses `epoll` for demultiplexing. - -Threads: - -* Demultiplexing using `epoll` is performed in one of the threads that calls -`io_context::run()`, `io_context::run_one()`, `io_context::poll()` or -`io_context::poll_one()`. - -* An additional thread per `io_context` is used to emulate asynchronous host -resolution. This thread is created on the first call to either -`ip::tcp::resolver::async_resolve()` or `ip::udp::resolver::async_resolve()`. - -Scatter-Gather: - -* At most `min(64,IOV_MAX)` buffers may be transferred in a single operation. - - -[heading Solaris] - -Demultiplexing mechanism: - -* Uses [^/dev/poll] for demultiplexing. - -Threads: - -* Demultiplexing using [^/dev/poll] is performed in one of the threads that -calls `io_context::run()`, `io_context::run_one()`, `io_context::poll()` or -`io_context::poll_one()`. - -* An additional thread per `io_context` is used to emulate asynchronous host -resolution. This thread is created on the first call to either -`ip::tcp::resolver::async_resolve()` or `ip::udp::resolver::async_resolve()`. - -Scatter-Gather: - -* At most `min(64,IOV_MAX)` buffers may be transferred in a single operation. - - -[heading QNX Neutrino] - -Demultiplexing mechanism: - -* Uses `select` for demultiplexing. This means that the number of file -descriptors in the process cannot be permitted to exceed `FD_SETSIZE`. - -Threads: - -* Demultiplexing using `select` is performed in one of the threads that calls -`io_context::run()`, `io_context::run_one()`, `io_context::poll()` or -`io_context::poll_one()`. - -* An additional thread per `io_context` is used to emulate asynchronous host -resolution. This thread is created on the first call to either -`ip::tcp::resolver::async_resolve()` or `ip::udp::resolver::async_resolve()`. - -Scatter-Gather: - -* At most `min(64,IOV_MAX)` buffers may be transferred in a single operation. - - -[heading Mac OS X] - -Demultiplexing mechanism: - -* Uses `kqueue` for demultiplexing. - -Threads: - -* Demultiplexing using `kqueue` is performed in one of the threads that calls -`io_context::run()`, `io_context::run_one()`, `io_context::poll()` or -`io_context::poll_one()`. - -* An additional thread per `io_context` is used to emulate asynchronous host -resolution. This thread is created on the first call to either -`ip::tcp::resolver::async_resolve()` or `ip::udp::resolver::async_resolve()`. - -Scatter-Gather: - -* At most `min(64,IOV_MAX)` buffers may be transferred in a single operation. - - -[heading FreeBSD] - -Demultiplexing mechanism: - -* Uses `kqueue` for demultiplexing. - -Threads: - -* Demultiplexing using `kqueue` is performed in one of the threads that calls -`io_context::run()`, `io_context::run_one()`, `io_context::poll()` or -`io_context::poll_one()`. - -* An additional thread per `io_context` is used to emulate asynchronous host -resolution. This thread is created on the first call to either -`ip::tcp::resolver::async_resolve()` or `ip::udp::resolver::async_resolve()`. - -Scatter-Gather: - -* At most `min(64,IOV_MAX)` buffers may be transferred in a single operation. - - -[heading AIX] - -Demultiplexing mechanism: - -* Uses `select` for demultiplexing. This means that the number of file -descriptors in the process cannot be permitted to exceed `FD_SETSIZE`. - -Threads: - -* Demultiplexing using `select` is performed in one of the threads that calls -`io_context::run()`, `io_context::run_one()`, `io_context::poll()` or -`io_context::poll_one()`. - -* An additional thread per `io_context` is used to emulate asynchronous host -resolution. This thread is created on the first call to either -`ip::tcp::resolver::async_resolve()` or `ip::udp::resolver::async_resolve()`. - -Scatter-Gather: - -* At most `min(64,IOV_MAX)` buffers may be transferred in a single operation. - - -[heading HP-UX] - -Demultiplexing mechanism: - -* Uses `select` for demultiplexing. This means that the number of file -descriptors in the process cannot be permitted to exceed `FD_SETSIZE`. - -Threads: - -* Demultiplexing using `select` is performed in one of the threads that calls -`io_context::run()`, `io_context::run_one()`, `io_context::poll()` or -`io_context::poll_one()`. - -* An additional thread per `io_context` is used to emulate asynchronous host -resolution. This thread is created on the first call to either -`ip::tcp::resolver::async_resolve()` or `ip::udp::resolver::async_resolve()`. - -Scatter-Gather: - -* At most `min(64,IOV_MAX)` buffers may be transferred in a single operation. - - -[heading Tru64] - -Demultiplexing mechanism: - -* Uses `select` for demultiplexing. This means that the number of file -descriptors in the process cannot be permitted to exceed `FD_SETSIZE`. - -Threads: - -* Demultiplexing using `select` is performed in one of the threads that calls -`io_context::run()`, `io_context::run_one()`, `io_context::poll()` or -`io_context::poll_one()`. - -* An additional thread per `io_context` is used to emulate asynchronous host -resolution. This thread is created on the first call to either -`ip::tcp::resolver::async_resolve()` or `ip::udp::resolver::async_resolve()`. - -Scatter-Gather: - -* At most `min(64,IOV_MAX)` buffers may be transferred in a single operation. - - -[heading Windows 95, 98 and Me] - -Demultiplexing mechanism: - -* Uses `select` for demultiplexing. - -Threads: - -* Demultiplexing using `select` is performed in one of the threads that calls -`io_context::run()`, `io_context::run_one()`, `io_context::poll()` or -`io_context::poll_one()`. - -* An additional thread per `io_context` is used to emulate asynchronous host -resolution. This thread is created on the first call to either -`ip::tcp::resolver::async_resolve()` or `ip::udp::resolver::async_resolve()`. - -Scatter-Gather: - -* For sockets, at most 16 buffers may be transferred in a single operation. - - -[heading Windows NT, 2000, XP, 2003, Vista, 7 and 8] - -Demultiplexing mechanism: - -* Uses overlapped I/O and I/O completion ports for all asynchronous socket -operations except for asynchronous connect. - -* Uses `select` for emulating asynchronous connect. - -Threads: - -* Demultiplexing using I/O completion ports is performed in all threads that call -`io_context::run()`, `io_context::run_one()`, `io_context::poll()` or -`io_context::poll_one()`. - -* An additional thread per `io_context` is used to trigger timers. This thread -is created on construction of the first `basic_deadline_timer` or -`basic_waitable_timer` objects. - -* An additional thread per `io_context` is used for the `select` -demultiplexing. This thread is created on the first call to `async_connect()`. - -* An additional thread per `io_context` is used to emulate asynchronous host -resolution. This thread is created on the first call to either -`ip::tcp::resolver::async_resolve()` or `ip::udp::resolver::async_resolve()`. - -Scatter-Gather: - -* For sockets, at most 64 buffers may be transferred in a single operation. - -* For stream-oriented handles, only one buffer may be transferred in a single -operation. - -[heading Windows Runtime] - -Boost.Asio provides limited support for the Windows Runtime. It requires that the -language extensions be enabled. Due to the restricted facilities exposed by the -Windows Runtime API, the support comes with the following caveats: - -* The core facilities such as the `io_context`, `strand`, buffers, composed - operations, timers, etc., should all work as normal. - -* For sockets, only client-side TCP is supported. - -* Explicit binding of a client-side TCP socket is not supported. - -* The `cancel()` function is not supported for sockets. Asynchronous - operations may only be cancelled by closing the socket. - -* Operations that use `null_buffers` are not supported. - -* Only `tcp::no_delay` and `socket_base::keep_alive` options are supported. - -* Resolvers do not support service names, only numbers. I.e. you must - use "80" rather than "http". - -* Most resolver query flags have no effect. - -Demultiplexing mechanism: - -* Uses the `Windows::Networking::Sockets::StreamSocket` class to implement - asynchronous TCP socket operations. - -Threads: - -* Event completions are delivered to the Windows thread pool and posted to the - `io_context` for the handler to be executed. - -* An additional thread per `io_context` is used to trigger timers. This thread - is created on construction of the first timer objects. - -Scatter-Gather: - -* For sockets, at most one buffer may be transferred in a single operation. - - -[endsect] diff --git a/boost-asio/doc/overview/iostreams.qbk b/boost-asio/doc/overview/iostreams.qbk deleted file mode 100644 index 8ed690309..000000000 --- a/boost-asio/doc/overview/iostreams.qbk +++ /dev/null @@ -1,72 +0,0 @@ -[/ - / Copyright (c) 2003-2018 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] - -Boost.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_context ioc; - - ip::tcp::endpoint endpoint(tcp::v4(), 80); - ip::tcp::acceptor acceptor(ios, endpoint); - - for (;;) - { - ip::tcp::iostream stream; - acceptor.accept(stream.socket()); - ... - } - -Timeouts may be set by calling `expires_at()` or `expires_from_now()` to -establish a deadline. Any socket operations that occur past the deadline will -put the iostream into a "bad" state. - -For example, a simple client program like this: - - ip::tcp::iostream stream; - stream.expires_from_now(boost::posix_time::seconds(60)); - stream.connect("www.boost.org", "http"); - stream << "GET /LICENSE_1_0.txt HTTP/1.0\r\n"; - stream << "Host: www.boost.org\r\n"; - stream << "Accept: */*\r\n"; - stream << "Connection: close\r\n\r\n"; - stream.flush(); - std::cout << stream.rdbuf(); - -will fail if all the socket operations combined take longer than 60 seconds. - -If an error does occur, the iostream's `error()` member function may be used to -retrieve the error code from the most recent system call: - - if (!stream) - { - std::cout << "Error: " << stream.error().message() << "\n"; - } - -[heading See Also] - -[link boost_asio.reference.ip__tcp.iostream ip::tcp::iostream], -[link boost_asio.reference.basic_socket_iostream basic_socket_iostream], -[link boost_asio.examples.cpp03_examples.iostreams iostreams examples]. - -[heading Notes] - -These iostream templates only support `char`, not `wchar_t`, and do not perform -any code conversion. - -[endsect] diff --git a/boost-asio/doc/overview/line_based.qbk b/boost-asio/doc/overview/line_based.qbk deleted file mode 100644 index c7bc9299e..000000000 --- a/boost-asio/doc/overview/line_based.qbk +++ /dev/null @@ -1,118 +0,0 @@ -[/ - / Copyright (c) 2003-2018 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:line_based Line-Based Operations] - -Many commonly-used internet protocols are line-based, which means that they -have protocol elements that are delimited by the character sequence `"\r\n"`. -Examples include HTTP, SMTP and FTP. To more easily permit the implementation -of line-based protocols, as well as other protocols that use delimiters, Boost.Asio -includes the functions `read_until()` and `async_read_until()`. - -The following example illustrates the use of `async_read_until()` in an HTTP -server, to receive the first line of an HTTP request from a client: - - class http_connection - { - ... - - void start() - { - boost::asio::async_read_until(socket_, data_, "\r\n", - boost::bind(&http_connection::handle_request_line, this, _1)); - } - - void handle_request_line(boost::system::error_code ec) - { - if (!ec) - { - std::string method, uri, version; - char sp1, sp2, cr, lf; - std::istream is(&data_); - is.unsetf(std::ios_base::skipws); - is >> method >> sp1 >> uri >> sp2 >> version >> cr >> lf; - ... - } - } - - ... - - boost::asio::ip::tcp::socket socket_; - boost::asio::streambuf data_; - }; - -The `streambuf` data member serves as a place to store the data that has been -read from the socket before it is searched for the delimiter. It is important -to remember that there may be additional data ['after] the delimiter. This -surplus data should be left in the `streambuf` so that it may be inspected by a -subsequent call to `read_until()` or `async_read_until()`. - -The delimiters may be specified as a single `char`, a `std::string` or a -`boost::regex`. The `read_until()` and `async_read_until()` functions also -include overloads that accept a user-defined function object called a match -condition. For example, to read data into a streambuf until whitespace is -encountered: - - typedef boost::asio::buffers_iterator< - boost::asio::streambuf::const_buffers_type> iterator; - - std::pair - match_whitespace(iterator begin, iterator end) - { - iterator i = begin; - while (i != end) - if (std::isspace(*i++)) - return std::make_pair(i, true); - return std::make_pair(i, false); - } - ... - boost::asio::streambuf b; - boost::asio::read_until(s, b, match_whitespace); - -To read data into a streambuf until a matching character is found: - - class match_char - { - public: - explicit match_char(char c) : c_(c) {} - - template - std::pair operator()( - Iterator begin, Iterator end) const - { - Iterator i = begin; - while (i != end) - if (c_ == *i++) - return std::make_pair(i, true); - return std::make_pair(i, false); - } - - private: - char c_; - }; - - namespace boost { namespace asio { - template <> struct is_match_condition - : public boost::true_type {}; - } } // namespace boost::asio - ... - boost::asio::streambuf b; - boost::asio::read_until(s, b, match_char('a')); - -The `is_match_condition<>` type trait automatically evaluates to true for -functions, and for function objects with a nested `result_type` typedef. For -other types the trait must be explicitly specialised, as shown above. - -[heading See Also] - -[link boost_asio.reference.async_read_until async_read_until()], -[link boost_asio.reference.is_match_condition is_match_condition], -[link boost_asio.reference.read_until read_until()], -[link boost_asio.reference.streambuf streambuf], -[link boost_asio.examples.cpp03_examples.http_client HTTP client example]. - -[endsect] diff --git a/boost-asio/doc/overview/other_protocols.qbk b/boost-asio/doc/overview/other_protocols.qbk deleted file mode 100644 index faf48ded0..000000000 --- a/boost-asio/doc/overview/other_protocols.qbk +++ /dev/null @@ -1,94 +0,0 @@ -[/ - / Copyright (c) 2003-2018 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:other_protocols Support for Other Protocols] - -Support for other socket protocols (such as Bluetooth or IRCOMM sockets) can be -added by implementing the [link boost_asio.reference.Protocol protocol type -requirements]. However, in many cases these protocols may also be used with -Boost.Asio's generic protocol support. For this, Boost.Asio provides the following four -classes: - -* [link boost_asio.reference.generic__datagram_protocol `generic::datagram_protocol`] -* [link boost_asio.reference.generic__raw_protocol `generic::raw_protocol`] -* [link boost_asio.reference.generic__seq_packet_protocol `generic::seq_packet_protocol`] -* [link boost_asio.reference.generic__stream_protocol `generic::stream_protocol`] - -These classes implement the [link boost_asio.reference.Protocol 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 example: - - boost::asio::generic::stream_protocol::socket my_socket(my_io_context); - my_socket.open(boost::asio::generic::stream_protocol(AF_INET, IPPROTO_TCP)); - ... - -An endpoint class template, [link boost_asio.reference.generic__basic_endpoint -`boost::asio::generic::basic_endpoint`], is included to support these protocol -classes. This endpoint can hold any other endpoint type, provided its native -representation fits into a `sockaddr_storage` object. This class will also -convert from other types that implement the [link boost_asio.reference.Endpoint -endpoint] type requirements: - - boost::asio::ip::tcp::endpoint my_endpoint1 = ...; - boost::asio::generic::stream_protocol::endpoint my_endpoint2(my_endpoint1); - -The conversion is implicit, so as to support the following use cases: - - boost::asio::generic::stream_protocol::socket my_socket(my_io_context); - boost::asio::ip::tcp::endpoint my_endpoint = ...; - my_socket.connect(my_endpoint); - -[heading C++11 Move Construction] - -When using C++11, it is possible to perform move construction from a socket (or -acceptor) object to convert to the more generic protocol's socket (or acceptor) -type. If the protocol conversion is valid: - - Protocol1 p1 = ...; - Protocol2 p2(p1); - -then the corresponding socket conversion is allowed: - - Protocol1::socket my_socket1(my_io_context); - ... - Protocol2::socket my_socket2(std::move(my_socket1)); - -For example, one possible conversion is from a TCP socket to a generic -stream-oriented socket: - - boost::asio::ip::tcp::socket my_socket1(my_io_context); - ... - boost::asio::generic::stream_protocol::socket my_socket2(std::move(my_socket1)); - -These conversions are also available for move-assignment. - -These conversions are not limited to the above generic protocol classes. -User-defined protocols may take advantage of this feature by similarly ensuring -the conversion from `Protocol1` to `Protocol2` is valid, as above. - -[heading Accepting Generic Sockets] - -As a convenience, a socket acceptor's `accept()` and `async_accept()` functions -can directly accept into a different protocol's socket type, provided the -corresponding protocol conversion is valid. For example, the following is -supported because the protocol `boost::asio::ip::tcp` is convertible to -`boost::asio::generic::stream_protocol`: - - boost::asio::ip::tcp::acceptor my_acceptor(my_io_context); - ... - boost::asio::generic::stream_protocol::socket my_socket(my_io_context); - my_acceptor.accept(my_socket); - -[heading See Also] - -[link boost_asio.reference.generic__datagram_protocol `generic::datagram_protocol`], -[link boost_asio.reference.generic__raw_protocol `generic::raw_protocol`], -[link boost_asio.reference.generic__seq_packet_protocol `generic::seq_packet_protocol`], -[link boost_asio.reference.generic__stream_protocol `generic::stream_protocol`], -[link boost_asio.reference.Protocol protocol type requirements]. - -[endsect] diff --git a/boost-asio/doc/overview/posix.qbk b/boost-asio/doc/overview/posix.qbk deleted file mode 100644 index ea75ffd61..000000000 --- a/boost-asio/doc/overview/posix.qbk +++ /dev/null @@ -1,152 +0,0 @@ -[/ - / Copyright (c) 2003-2018 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:posix POSIX-Specific Functionality] - -[link boost_asio.overview.posix.local UNIX Domain Sockets] - -[link boost_asio.overview.posix.stream_descriptor Stream-Oriented File Descriptors] - -[link boost_asio.overview.posix.fork Fork] - -[section:local UNIX Domain Sockets] - -Boost.Asio provides basic support UNIX domain sockets (also known as local sockets). -The simplest use involves creating a pair of connected sockets. The following -code: - - local::stream_protocol::socket socket1(my_io_context); - local::stream_protocol::socket socket2(my_io_context); - local::connect_pair(socket1, socket2); - -will create a pair of stream-oriented sockets. To do the same for -datagram-oriented sockets, use: - - local::datagram_protocol::socket socket1(my_io_context); - local::datagram_protocol::socket socket2(my_io_context); - local::connect_pair(socket1, socket2); - -A UNIX domain socket server may be created by binding an acceptor to an -endpoint, in much the same way as one does for a TCP server: - - ::unlink("/tmp/foobar"); // Remove previous binding. - local::stream_protocol::endpoint ep("/tmp/foobar"); - local::stream_protocol::acceptor acceptor(my_io_context, ep); - local::stream_protocol::socket socket(my_io_context); - acceptor.accept(socket); - -A client that connects to this server might look like: - - local::stream_protocol::endpoint ep("/tmp/foobar"); - local::stream_protocol::socket socket(my_io_context); - socket.connect(ep); - -Transmission of file descriptors or credentials across UNIX domain sockets is -not directly supported within Boost.Asio, but may be achieved by accessing the -socket's underlying descriptor using the [link -boost_asio.reference.basic_socket.native_handle native_handle()] member function. - -[heading See Also] - -[link boost_asio.reference.local__connect_pair local::connect_pair], -[link boost_asio.reference.local__datagram_protocol local::datagram_protocol], -[link boost_asio.reference.local__datagram_protocol.endpoint local::datagram_protocol::endpoint], -[link boost_asio.reference.local__datagram_protocol.socket local::datagram_protocol::socket], -[link boost_asio.reference.local__stream_protocol local::stream_protocol], -[link boost_asio.reference.local__stream_protocol.acceptor local::stream_protocol::acceptor], -[link boost_asio.reference.local__stream_protocol.endpoint local::stream_protocol::endpoint], -[link boost_asio.reference.local__stream_protocol.iostream local::stream_protocol::iostream], -[link boost_asio.reference.local__stream_protocol.socket local::stream_protocol::socket], -[link boost_asio.examples.cpp03_examples.unix_domain_sockets UNIX domain sockets examples]. - -[heading Notes] - -UNIX domain sockets are only available at compile time if supported by the -target operating system. A program may test for the macro -`BOOST_ASIO_HAS_LOCAL_SOCKETS` to determine whether they are supported. - -[endsect] - -[section:stream_descriptor Stream-Oriented File Descriptors] - -Boost.Asio includes classes added to permit synchronous and asynchronous read and -write operations to be performed on POSIX file descriptors, such as pipes, -standard input and output, and various devices. - -These classes also provide limited support for regular files. This support -assumes that the underlying read and write operations provided by the operating -system never fail with `EAGAIN` or `EWOULDBLOCK`. (This assumption normally -holds for buffered file I/O.) Synchronous and asynchronous read and write -operations on file descriptors will succeed but the I/O will always be -performed immediately. Wait operations, and operations involving -`boost::asio::null_buffers`, are not portably supported. - -For example, to perform read and write operations on standard input -and output, the following objects may be created: - - posix::stream_descriptor in(my_io_context, ::dup(STDIN_FILENO)); - posix::stream_descriptor out(my_io_context, ::dup(STDOUT_FILENO)); - -These are then used as synchronous or asynchronous read and write streams. This -means the objects can be used with any of the [link boost_asio.reference.read -read()], [link boost_asio.reference.async_read async_read()], [link -boost_asio.reference.write write()], [link boost_asio.reference.async_write async_write()], -[link boost_asio.reference.read_until read_until()] or [link -boost_asio.reference.async_read_until async_read_until()] free functions. - -[heading See Also] - -[link boost_asio.reference.posix__stream_descriptor posix::stream_descriptor], -[link boost_asio.examples.cpp03_examples.chat Chat example (C++03)], -[link boost_asio.examples.cpp11_examples.chat Chat example (C++11)]. - -[heading Notes] - -POSIX stream descriptors are only available at compile time if supported by the -target operating system. A program may test for the macro -`BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR` to determine whether they are supported. - -[endsect] - -[section:fork Fork] - -Boost.Asio supports programs that utilise the `fork()` system call. Provided the -program calls `io_context.notify_fork()` at the appropriate times, Boost.Asio will -recreate any internal file descriptors (such as the "self-pipe trick" -descriptor used for waking up a reactor). The notification is usually performed -as follows: - - io_context_.notify_fork(boost::asio::io_context::fork_prepare); - if (fork() == 0) - { - io_context_.notify_fork(boost::asio::io_context::fork_child); - ... - } - else - { - io_context_.notify_fork(boost::asio::io_context::fork_parent); - ... - } - -User-defined services can also be made fork-aware by overriding the -`io_context::service::notify_fork()` virtual function. - -Note that any file descriptors accessible via Boost.Asio's public API (e.g. the -descriptors underlying `basic_socket<>`, `posix::stream_descriptor`, etc.) are -not altered during a fork. It is the program's responsibility to manage these -as required. - -[heading See Also] - -[link boost_asio.reference.io_context.notify_fork io_context::notify_fork()], -[link boost_asio.reference.io_context.fork_event io_context::fork_event], -[link boost_asio.reference.execution_context__service.notify_fork io_context::service::notify_fork()], -[link boost_asio.examples.cpp03_examples.fork Fork examples]. - -[endsect] - -[endsect] diff --git a/boost-asio/doc/overview/proactor.dot b/boost-asio/doc/overview/proactor.dot deleted file mode 100644 index 871723408..000000000 --- a/boost-asio/doc/overview/proactor.dot +++ /dev/null @@ -1,100 +0,0 @@ -digraph g -{ - edge - [ - fontname="Helvetica", - fontsize=10, - labelfontname="Helvetica", - labelfontsize=10 - ]; - - node - [ - fontname="Helvetica", - fontsize=10, - shape=record - ]; - - initiator - [ - label="Initiator" - ]; - - async_processor - [ - label="Asynchronous\nOperation Processor" - ]; - - async_op - [ - label="Asynchronous\nOperation" - ]; - - completion_queue - [ - label="Completion\nEvent Queue" - ]; - - async_event_demuxer - [ - label="Asynchronous\nEvent Demultiplexer" - ]; - - proactor - [ - label="Proactor" - ]; - - handler - [ - label="Completion\nHandler" - ]; - - initiator -> async_processor - [ - label="uses", - style="dashed" - ]; - - initiator -> async_op - [ - label="starts", - style="dashed" - ]; - - initiator -> handler - [ - label="creates", - style="dashed" - ]; - - async_processor -> async_op - [ - label="executes", - style="dashed" - ]; - - async_processor -> completion_queue - [ - label="enqueues", - style="dashed" - ]; - - async_op -> handler; - - async_event_demuxer -> completion_queue - [ - label="dequeues", - style="dashed" - ]; - - proactor -> async_event_demuxer - [ - ]; - - proactor -> handler - [ - label="demultiplexes\n& dispatches" - style="dashed" - ]; -} diff --git a/boost-asio/doc/overview/proactor.png b/boost-asio/doc/overview/proactor.png deleted file mode 100644 index a0653b010..000000000 Binary files a/boost-asio/doc/overview/proactor.png and /dev/null differ diff --git a/boost-asio/doc/overview/protocols.qbk b/boost-asio/doc/overview/protocols.qbk deleted file mode 100644 index 2b51bbb2d..000000000 --- a/boost-asio/doc/overview/protocols.qbk +++ /dev/null @@ -1,149 +0,0 @@ -[/ - / Copyright (c) 2003-2018 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:protocols TCP, UDP and ICMP] - -Boost.Asio provides off-the-shelf support for the internet protocols TCP, UDP and -ICMP. - -[heading TCP Clients] - -Hostname resolution is performed using a resolver, where host and service names -are looked up and converted into one or more endpoints: - - ip::tcp::resolver resolver(my_io_context); - ip::tcp::resolver::query query("www.boost.org", "http"); - ip::tcp::resolver::iterator iter = resolver.resolve(query); - ip::tcp::resolver::iterator end; // End marker. - while (iter != end) - { - ip::tcp::endpoint endpoint = *iter++; - std::cout << endpoint << std::endl; - } - -The list of endpoints obtained above could contain both IPv4 and IPv6 endpoints, -so a program should try each of them until it finds one that works. This keeps the -client program independent of a specific IP version. - -To simplify the development of protocol-independent programs, TCP clients may -establish connections using the free functions [link boost_asio.reference.connect -connect()] and [link boost_asio.reference.async_connect async_connect()]. These -operations try each endpoint in a list until the socket is successfully -connected. For example, a single call: - - ip::tcp::socket socket(my_io_context); - boost::asio::connect(socket, resolver.resolve(query)); - -will synchronously try all endpoints until one is successfully connected. -Similarly, an asynchronous connect may be performed by writing: - - boost::asio::async_connect(socket_, iter, - boost::bind(&client::handle_connect, this, - boost::asio::placeholders::error)); - - // ... - - void handle_connect(const error_code& error) - { - if (!error) - { - // Start read or write operations. - } - else - { - // Handle error. - } - } - -When a specific endpoint is available, a socket can be created and connected: - - ip::tcp::socket socket(my_io_context); - socket.connect(endpoint); - -Data may be read from or written to a connected TCP socket using the [link -boost_asio.reference.basic_stream_socket.receive receive()], [link -boost_asio.reference.basic_stream_socket.async_receive async_receive()], [link -boost_asio.reference.basic_stream_socket.send send()] or [link -boost_asio.reference.basic_stream_socket.async_send async_send()] member functions. -However, as these could result in [link boost_asio.overview.core.streams short writes -or reads], an application will typically use the following operations instead: -[link boost_asio.reference.read read()], [link boost_asio.reference.async_read -async_read()], [link boost_asio.reference.write write()] and [link -boost_asio.reference.async_write async_write()]. - -[heading TCP Servers] - -A program uses an acceptor to accept incoming TCP connections: - - ip::tcp::acceptor acceptor(my_io_context, my_endpoint); - ... - ip::tcp::socket socket(my_io_context); - acceptor.accept(socket); - -After a socket has been successfully accepted, it may be read from or written -to as illustrated for TCP clients above. - -[heading UDP] - -UDP hostname resolution is also performed using a resolver: - - ip::udp::resolver resolver(my_io_context); - ip::udp::resolver::query query("localhost", "daytime"); - ip::udp::resolver::iterator iter = resolver.resolve(query); - ... - -A UDP socket is typically bound to a local endpoint. The following code will -create an IP version 4 UDP socket and bind it to the "any" address on port -`12345`: - - ip::udp::endpoint endpoint(ip::udp::v4(), 12345); - ip::udp::socket socket(my_io_context, endpoint); - -Data may be read from or written to an unconnected UDP socket using the [link -boost_asio.reference.basic_datagram_socket.receive_from receive_from()], [link -boost_asio.reference.basic_datagram_socket.async_receive_from async_receive_from()], -[link boost_asio.reference.basic_datagram_socket.send_to send_to()] or [link -boost_asio.reference.basic_datagram_socket.async_send_to async_send_to()] member -functions. For a connected UDP socket, use the [link -boost_asio.reference.basic_datagram_socket.receive receive()], [link -boost_asio.reference.basic_datagram_socket.async_receive async_receive()], [link -boost_asio.reference.basic_datagram_socket.send send()] or [link -boost_asio.reference.basic_datagram_socket.async_send async_send()] member functions. - -[heading ICMP] - -As with TCP and UDP, ICMP hostname resolution is performed using a resolver: - - ip::icmp::resolver resolver(my_io_context); - ip::icmp::resolver::query query("localhost", ""); - ip::icmp::resolver::iterator iter = resolver.resolve(query); - ... - -An ICMP socket may be bound to a local endpoint. The following code will create -an IP version 6 ICMP socket and bind it to the "any" address: - - ip::icmp::endpoint endpoint(ip::icmp::v6(), 0); - ip::icmp::socket socket(my_io_context, endpoint); - -The port number is not used for ICMP. - -Data may be read from or written to an unconnected ICMP socket using the [link -boost_asio.reference.basic_raw_socket.receive_from receive_from()], [link -boost_asio.reference.basic_raw_socket.async_receive_from async_receive_from()], -[link boost_asio.reference.basic_raw_socket.send_to send_to()] or [link -boost_asio.reference.basic_raw_socket.async_send_to async_send_to()] member -functions. - -[heading See Also] - -[link boost_asio.reference.ip__tcp ip::tcp], -[link boost_asio.reference.ip__udp ip::udp], -[link boost_asio.reference.ip__icmp ip::icmp], -[link boost_asio.tutorial.tutdaytime1 daytime protocol tutorials], -[link boost_asio.examples.cpp03_examples.icmp ICMP ping example]. - -[endsect] diff --git a/boost-asio/doc/overview/rationale.qbk b/boost-asio/doc/overview/rationale.qbk deleted file mode 100644 index e4f14b04e..000000000 --- a/boost-asio/doc/overview/rationale.qbk +++ /dev/null @@ -1,54 +0,0 @@ -[/ - / Copyright (c) 2003-2018 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:rationale Rationale] - -Most programs interact with the outside world in some way, whether it be via a -file, a network, a serial cable, or the console. Sometimes, as is the case with -networking, individual I/O operations can take a long time to complete. This -poses particular challenges to application development. - -Boost.Asio provides the tools to manage these long running operations, without -requiring programs to use concurrency models based on threads and explicit -locking. - -The Boost.Asio library is intended for programmers using C++ for systems programming, -where access to operating system functionality such as networking is often -required. In particular, Boost.Asio addresses the following goals: - -* [*Portability.] The library should support a range of commonly used operating -systems, and provide consistent behaviour across these operating systems. - -* [*Scalability.] The library should facilitate the development of network -applications that scale to thousands of concurrent connections. The library -implementation for each operating system should use the mechanism that best -enables this scalability. - -* [*Efficiency.] The library should support techniques such as scatter-gather -I/O, and allow programs to minimise data copying. - -* [*Model concepts from established APIs, such as BSD sockets.] The -BSD socket API is widely implemented and understood, and is covered in much -literature. Other programming languages often use a similar interface for -networking APIs. As far as is reasonable, Boost.Asio should leverage existing -practice. - -* [*Ease of use.] The library should provide a lower entry barrier for new -users by taking a toolkit, rather than framework, approach. That is, it should -try to minimise the up-front investment in time to just learning a few basic -rules and guidelines. After that, a library user should only need to understand -the specific functions that are being used. - -* [*Basis for further abstraction.] The library should permit the development -of other libraries that provide higher levels of abstraction. For example, -implementations of commonly used protocols such as HTTP. - -Although Boost.Asio started life focused primarily on networking, its concepts of -asynchronous I/O have been extended to include other operating system resources -such as serial ports, file descriptors, and so on. - -[endsect] diff --git a/boost-asio/doc/overview/reactor.qbk b/boost-asio/doc/overview/reactor.qbk deleted file mode 100644 index 1079bf10d..000000000 --- a/boost-asio/doc/overview/reactor.qbk +++ /dev/null @@ -1,44 +0,0 @@ -[/ - / Copyright (c) 2003-2018 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:reactor Reactor-Style Operations] - -Sometimes a program must be integrated with a third-party library that wants to -perform the I/O operations itself. To facilitate this, Boost.Asio includes -synchronous and asynchronous operations that may be used to wait for a socket -to become ready to read, ready to write, or to have a pending error condition. - -As an example, to perform a non-blocking read something like the following may -be used: - - ip::tcp::socket socket(my_io_context); - ... - socket.non_blocking(true); - ... - socket.async_wait(ip::tcp::socket::wait_read, read_handler); - ... - void read_handler(boost::system::error_code ec) - { - if (!ec) - { - std::vector buf(socket.available()); - socket.read_some(buffer(buf)); - } - } - -These operations are supported for sockets on all platforms, and for the POSIX -stream-oriented descriptor classes. - -[heading See Also] - -[link boost_asio.reference.basic_socket.wait basic_socket::wait()], -[link boost_asio.reference.basic_socket.async_wait basic_socket::async_wait()], -[link boost_asio.reference.basic_socket.non_blocking basic_socket::non_blocking()], -[link boost_asio.reference.basic_socket.native_non_blocking basic_socket::native_non_blocking()], -[link boost_asio.examples.cpp03_examples.nonblocking nonblocking example]. - -[endsect] diff --git a/boost-asio/doc/overview/serial_ports.qbk b/boost-asio/doc/overview/serial_ports.qbk deleted file mode 100644 index 0883f4872..000000000 --- a/boost-asio/doc/overview/serial_ports.qbk +++ /dev/null @@ -1,45 +0,0 @@ -[/ - / Copyright (c) 2003-2018 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:serial_ports Serial Ports] - -Boost.Asio includes classes for creating and manipulating serial ports in a portable -manner. For example, a serial port may be opened using: - - serial_port port(my_io_context, name); - -where name is something like `"COM1"` on Windows, and `"/dev/ttyS0"` on POSIX -platforms. - -Once opened, the serial port may be used as a [link boost_asio.overview.core.streams -stream]. This means the objects can be used with any of the [link -boost_asio.reference.read read()], [link boost_asio.reference.async_read async_read()], -[link boost_asio.reference.write write()], [link boost_asio.reference.async_write -async_write()], [link boost_asio.reference.read_until read_until()] or [link -boost_asio.reference.async_read_until async_read_until()] free functions. - -The serial port implementation also includes option classes for configuring the -port's baud rate, flow control type, parity, stop bits and character size. - -[heading See Also] - -[link boost_asio.reference.serial_port serial_port], -[link boost_asio.reference.serial_port_base serial_port_base], -[link boost_asio.reference.serial_port_base__baud_rate serial_port_base::baud_rate], -[link boost_asio.reference.serial_port_base__flow_control serial_port_base::flow_control], -[link boost_asio.reference.serial_port_base__parity serial_port_base::parity], -[link boost_asio.reference.serial_port_base__stop_bits serial_port_base::stop_bits], -[link boost_asio.reference.serial_port_base__character_size serial_port_base::character_size]. - -[heading Notes] - -Serial ports are available on all POSIX platforms. For Windows, serial ports -are only available at compile time when the I/O completion port backend is used -(which is the default). A program may test for the macro -`BOOST_ASIO_HAS_SERIAL_PORT` to determine whether they are supported. - -[endsect] diff --git a/boost-asio/doc/overview/signals.qbk b/boost-asio/doc/overview/signals.qbk deleted file mode 100644 index ee3e80552..000000000 --- a/boost-asio/doc/overview/signals.qbk +++ /dev/null @@ -1,44 +0,0 @@ -[/ - / Copyright (c) 2003-2018 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:signals Signal Handling] - -Boost.Asio supports signal handling using a class called [link -boost_asio.reference.signal_set 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 [link boost_asio.reference.signal_set signal_set] objects, -however the signal number must be used only with Boost.Asio. - - void handler( - const boost::system::error_code& error, - int signal_number) - { - if (!error) - { - // A signal occurred. - } - } - - ... - - // Construct a signal set registered for process termination. - boost::asio::signal_set signals(io_context, SIGINT, SIGTERM); - - // Start an asynchronous wait for one of the signals to occur. - signals.async_wait(handler); - -Signal handling also works on Windows, as the Microsoft Visual C++ runtime -library maps console events like Ctrl+C to the equivalent signal. - -[heading See Also] - -[link boost_asio.reference.signal_set signal_set], -[link boost_asio.examples.cpp03_examples.http_server HTTP server example (C++03)], -[link boost_asio.examples.cpp11_examples.http_server HTTP server example (C++11)]. - -[endsect] diff --git a/boost-asio/doc/overview/spawn.qbk b/boost-asio/doc/overview/spawn.qbk deleted file mode 100644 index 066a604e1..000000000 --- a/boost-asio/doc/overview/spawn.qbk +++ /dev/null @@ -1,102 +0,0 @@ -[/ - / Copyright (c) 2003-2018 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:spawn Stackful Coroutines] - -The [link boost_asio.reference.spawn `spawn()`] function is a high-level wrapper for -running stackful coroutines. It is based on the Boost.Coroutine library. The -`spawn()` function enables programs to implement asynchronous logic in a -synchronous manner, as shown in the following example: - - boost::asio::spawn(my_strand, do_echo); - - // ... - - void do_echo(boost::asio::yield_context yield) - { - try - { - char data[128]; - for (;;) - { - std::size_t length = - my_socket.async_read_some( - boost::asio::buffer(data), yield); - - boost::asio::async_write(my_socket, - boost::asio::buffer(data, length), yield); - } - } - catch (std::exception& e) - { - // ... - } - } - -The first argument to `spawn()` may be a -[link boost_asio.reference.io_context__strand `strand`], -[link boost_asio.reference.io_context `io_context`], or -[link boost_asio.reference.CompletionHandler completion handler]. -This argument determines the context in which the coroutine is permitted to -execute. For example, a server's per-client object may consist of multiple -coroutines; they should all run on the same `strand` so that no explicit -synchronisation is required. - -The second argument is a function object with signature: - - void coroutine(boost::asio::yield_context yield); - -that specifies the code to be run as part of the coroutine. The parameter -`yield` may be passed to an asynchronous operation in place of the completion -handler, as in: - - std::size_t length = - my_socket.async_read_some( - boost::asio::buffer(data), yield); - -This starts the asynchronous operation and suspends the coroutine. The -coroutine will be resumed automatically when the asynchronous operation -completes. - -Where an asynchronous operation's handler signature has the form: - - void handler(boost::system::error_code ec, result_type result); - -the initiating function returns the result_type. In the `async_read_some` -example above, this is `size_t`. If the asynchronous operation fails, the -`error_code` is converted into a `system_error` exception and thrown. - -Where a handler signature has the form: - - void handler(boost::system::error_code ec); - -the initiating function returns `void`. As above, an error is passed back to -the coroutine as a `system_error` exception. - -To collect the `error_code` from an operation, rather than have it throw an -exception, associate the output variable with the `yield_context` as follows: - - boost::system::error_code ec; - std::size_t length = - my_socket.async_read_some( - boost::asio::buffer(data), yield[ec]); - -[*Note:] if `spawn()` is used with a custom completion handler of type -`Handler`, the function object signature is actually: - - void coroutine(boost::asio::basic_yield_context yield); - -[heading See Also] - -[link boost_asio.reference.spawn spawn], -[link boost_asio.reference.yield_context yield_context], -[link boost_asio.reference.basic_yield_context basic_yield_context], -[link boost_asio.examples.cpp03_examples.spawn Spawn example (C++03)], -[link boost_asio.examples.cpp11_examples.spawn Spawn example (C++11)], -[link boost_asio.overview.core.coroutine Stackless Coroutines]. - -[endsect] diff --git a/boost-asio/doc/overview/ssl.qbk b/boost-asio/doc/overview/ssl.qbk deleted file mode 100644 index fa383d563..000000000 --- a/boost-asio/doc/overview/ssl.qbk +++ /dev/null @@ -1,123 +0,0 @@ -[/ - / Copyright (c) 2003-2018 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:ssl SSL] - -Boost.Asio contains classes and class templates for basic SSL support. These classes -allow encrypted communication to be layered on top of an existing stream, such -as a TCP socket. - -Before creating an encrypted stream, an application must construct an SSL -context object. This object is used to set SSL options such as verification -mode, certificate files, and so on. As an illustration, client-side -initialisation may look something like: - - ssl::context ctx(ssl::context::sslv23); - ctx.set_verify_mode(ssl::verify_peer); - ctx.load_verify_file("ca.pem"); - -To use SSL with a TCP socket, one may write: - - ssl::stream ssl_sock(my_io_context, ctx); - -To perform socket-specific operations, such as establishing an outbound -connection or accepting an incoming one, the underlying socket must first be -obtained using the `ssl::stream` template's [link -boost_asio.reference.ssl__stream.lowest_layer `lowest_layer()`] member function: - - ip::tcp::socket::lowest_layer_type& sock = ssl_sock.lowest_layer(); - sock.connect(my_endpoint); - -In some use cases the underlying stream object will need to have a longer -lifetime than the SSL stream, in which case the template parameter should be a -reference to the stream type: - - ip::tcp::socket sock(my_io_context); - ssl::stream ssl_sock(sock, ctx); - -SSL handshaking must be performed prior to transmitting or receiving data over -an encrypted connection. This is accomplished using the `ssl::stream` -template's [link boost_asio.reference.ssl__stream.handshake handshake()] or [link -boost_asio.reference.ssl__stream.async_handshake async_handshake()] member functions. - -Once connected, SSL stream objects are used as synchronous or asynchronous read -and write streams. This means the objects can be used with any of the [link -boost_asio.reference.read read()], [link boost_asio.reference.async_read async_read()], -[link boost_asio.reference.write write()], [link boost_asio.reference.async_write -async_write()], [link boost_asio.reference.read_until read_until()] or [link -boost_asio.reference.async_read_until async_read_until()] free functions. - -[heading Certificate Verification] - -Boost.Asio provides various methods for configuring the way SSL certificates are -verified: - -* [link boost_asio.reference.ssl__context.set_default_verify_paths ssl::context::set_default_verify_paths()] -* [link boost_asio.reference.ssl__context.set_verify_mode ssl::context::set_verify_mode()] -* [link boost_asio.reference.ssl__context.set_verify_callback ssl::context::set_verify_callback()] -* [link boost_asio.reference.ssl__context.load_verify_file ssl::context::load_verify_file()] -* [link boost_asio.reference.ssl__stream.set_verify_mode ssl::stream::set_verify_mode()] -* [link boost_asio.reference.ssl__stream.set_verify_callback ssl::stream::set_verify_callback()] - -To simplify use cases where certificates are verified according to the rules in -RFC 2818 (certificate verification for HTTPS), Boost.Asio provides a reusable -verification callback as a function object: - -* [link boost_asio.reference.ssl__rfc2818_verification ssl::rfc2818_verification] - -The following example shows verification of a remote host's certificate -according to the rules used by HTTPS: - - using boost::asio::ip::tcp; - namespace ssl = boost::asio::ssl; - typedef ssl::stream ssl_socket; - - // Create a context that uses the default paths for - // finding CA certificates. - ssl::context ctx(ssl::context::sslv23); - ctx.set_default_verify_paths(); - - // Open a socket and connect it to the remote host. - boost::asio::io_context io_context; - ssl_socket sock(io_context, ctx); - tcp::resolver resolver(io_context); - tcp::resolver::query query("host.name", "https"); - boost::asio::connect(sock.lowest_layer(), resolver.resolve(query)); - sock.lowest_layer().set_option(tcp::no_delay(true)); - - // Perform SSL handshake and verify the remote host's - // certificate. - sock.set_verify_mode(ssl::verify_peer); - sock.set_verify_callback(ssl::rfc2818_verification("host.name")); - sock.handshake(ssl_socket::client); - - // ... read and write as normal ... - -[heading SSL and Threads] - -SSL stream objects perform no locking of their own. Therefore, it is essential -that all asynchronous SSL operations are performed in an implicit or explicit -[link boost_asio.overview.core.strands strand]. Note that this means that no -synchronisation is required (and so no locking overhead is incurred) in single -threaded programs. - -[heading See Also] - -[link boost_asio.reference.ssl__context ssl::context], -[link boost_asio.reference.ssl__rfc2818_verification ssl::rfc2818_verification], -[link boost_asio.reference.ssl__stream ssl::stream], -[link boost_asio.examples.cpp03_examples.ssl SSL example]. - -[heading Notes] - -[@http://www.openssl.org OpenSSL] is required to make use of Boost.Asio's SSL -support. When an application needs to use OpenSSL functionality that is not -wrapped by Boost.Asio, the underlying OpenSSL types may be obtained by calling [link -boost_asio.reference.ssl__context.native_handle `ssl::context::native_handle()`] or -[link boost_asio.reference.ssl__stream.native_handle `ssl::stream::native_handle()`]. - -[endsect] diff --git a/boost-asio/doc/overview/strands.qbk b/boost-asio/doc/overview/strands.qbk deleted file mode 100644 index 4b046e7c6..000000000 --- a/boost-asio/doc/overview/strands.qbk +++ /dev/null @@ -1,114 +0,0 @@ -[/ - / Copyright (c) 2003-2018 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:strands Strands: Use Threads Without Explicit Locking] - -A strand is defined as a strictly sequential invocation of event handlers (i.e. -no concurrent invocation). Use of strands allows execution of code in a -multithreaded program without the need for explicit locking (e.g. using -mutexes). - -Strands may be either implicit or explicit, as illustrated by the following -alternative approaches: - -* Calling io_context::run() from only one thread means all event handlers - execute in an implicit strand, due to the io_context's guarantee that handlers - are only invoked from inside run(). - -* Where there is a single chain of asynchronous operations associated with a - connection (e.g. in a half duplex protocol implementation like HTTP) there is - no possibility of concurrent execution of the handlers. This is an implicit - strand. - -* An explicit strand is an instance of `strand<>` or `io_context::strand`. All - event handler function objects need to be bound to the strand using - `boost::asio::bind_executor()` or otherwise posted/dispatched through the strand - object. - -In the case of composed asynchronous operations, such as `async_read()` or -`async_read_until()`, if a completion handler goes through a strand, then all -intermediate handlers should also go through the same strand. This is needed to -ensure thread safe access for any objects that are shared between the caller -and the composed operation (in the case of `async_read()` it's the socket, -which the caller can `close()` to cancel the operation). - -To achieve this, all asynchronous operations obtain the handler's associated -executor by using the `get_associated_executor` function. For example: - - boost::asio::associated_executor_t a = boost::asio::get_associated_executor(h); - -The associated executor must satisfy the Executor requirements. It will be used -by the asynchronous operation to submit both intermediate and final handlers -for execution. - -The executor may be customised for a particular handler type by specifying a -nested type `executor_type` and member function `get_executor()`: - - class my_handler - { - public: - // Custom implementation of Executor type requirements. - typedef my_executor executor_type; - - // Return a custom executor implementation. - executor_type get_executor() const noexcept - { - return my_executor(); - } - - void operator()() { ... } - }; - -In more complex cases, the `associated_executor` template may be partially -specialised directly: - - struct my_handler - { - void operator()() { ... } - }; - - namespace boost { namespace asio { - - template - struct associated_executor - { - // Custom implementation of Executor type requirements. - typedef my_executor type; - - // Return a custom executor implementation. - static type get(const my_handler&, - const Executor& = Executor()) noexcept - { - return my_executor(); - } - }; - - } } // namespace boost::asio - -The `boost::asio::bind_executor()` function is a helper to bind a specific executor -object, such as a strand, to a completion handler. This binding automatically -associates an executor as shown above. For example, to bind a strand to a -completion handler we would simply write: - - my_socket.async_read_some(my_buffer, - boost::asio::bind_executor(my_strand, - [](error_code ec, size_t length) - { - // ... - })); - -[heading See Also] - -[link boost_asio.reference.associated_executor associated_executor], -[link boost_asio.reference.get_associated_executor get_associated_executor], -[link boost_asio.reference.bind_executor bind_executor], -[link boost_asio.reference.strand strand], -[link boost_asio.reference.io_context__strand io_context::strand], -[link boost_asio.tutorial.tuttimer5 tutorial Timer.5], -[link boost_asio.examples.cpp03_examples.http_server_3 HTTP server 3 example]. - -[endsect] diff --git a/boost-asio/doc/overview/streams.qbk b/boost-asio/doc/overview/streams.qbk deleted file mode 100644 index eb8525096..000000000 --- a/boost-asio/doc/overview/streams.qbk +++ /dev/null @@ -1,62 +0,0 @@ -[/ - / Copyright (c) 2003-2018 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:streams Streams, Short Reads and Short Writes] - -Many I/O objects in Boost.Asio are stream-oriented. This means that: - -* There are no message boundaries. The data being transferred is a continuous - sequence of bytes. - -* Read or write operations may transfer fewer bytes than requested. This is - referred to as a short read or short write. - -Objects that provide stream-oriented I/O model one or more of the following -type requirements: - -* `SyncReadStream`, where synchronous read operations are performed using a - member function called `read_some()`. - -* `AsyncReadStream`, where asynchronous read operations are performed using a - member function called `async_read_some()`. - -* `SyncWriteStream`, where synchronous write operations are performed using a - member function called `write_some()`. - -* `AsyncWriteStream`, where synchronous write operations are performed using a - member function called `async_write_some()`. - -Examples of stream-oriented I/O objects include `ip::tcp::socket`, -`ssl::stream<>`, `posix::stream_descriptor`, `windows::stream_handle`, etc. - -Programs typically want to transfer an exact number of bytes. When a short read -or short write occurs the program must restart the operation, and continue to -do so until the required number of bytes has been transferred. Boost.Asio provides -generic functions that do this automatically: `read()`, `async_read()`, -`write()` and `async_write()`. - -[heading Why EOF is an Error] - -* The end of a stream can cause `read`, `async_read`, `read_until` or - `async_read_until` functions to violate their contract. E.g. - a read of N bytes may finish early due to EOF. - -* An EOF error may be used to distinguish the end of a stream from a successful - read of size 0. - -[heading See Also] - -[link boost_asio.reference.async_read async_read()], -[link boost_asio.reference.async_write async_write()], -[link boost_asio.reference.read read()], -[link boost_asio.reference.write write()], -[link boost_asio.reference.AsyncReadStream AsyncReadStream], -[link boost_asio.reference.AsyncWriteStream AsyncWriteStream], -[link boost_asio.reference.SyncReadStream SyncReadStream], -[link boost_asio.reference.SyncWriteStream SyncWriteStream]. - -[endsect] diff --git a/boost-asio/doc/overview/sync_op.dot b/boost-asio/doc/overview/sync_op.dot deleted file mode 100644 index 32e3e9ccd..000000000 --- a/boost-asio/doc/overview/sync_op.dot +++ /dev/null @@ -1,67 +0,0 @@ -digraph g -{ - graph - [ - nodesep="0.6" - ]; - - edge - [ - fontname="Helvetica", - fontsize=10, - labelfontname="Helvetica", - labelfontsize=10 - ]; - - node - [ - fontname="Helvetica", - fontsize=10, - shape=box - ]; - - edge - [ - arrowhead="open" - ] - - // Program elements. - { - operating_system [ label="Operating System", shape=ellipse ]; - io_service [ label="io_service" ]; - io_object [ label="I/O Object\ne.g. socket" ]; - your_program [ label="Your Program" ]; - } - - // Owning relationships. - { - edge [ arrowtail="diamond" ]; - your_program:w -> io_object:nw; - your_program:se -> io_service:ne; - } - - // Non-owning relationships; - { - io_object:sw -> io_service:w; - } - - // Actions. - { - edge [ style="dashed", color="#808080" ]; - - // Forward actions. - { - your_program:sw -> io_object:n [ label="1" ]; - io_object:s -> io_service:nw [ label="2" ]; - io_service:sw -> operating_system:nw [ label="3" ]; - } - - // Reverse actions. - { - edge [ arrowhead="none", arrowtail="open" ]; - io_service:se -> operating_system:ne [ label="4" ]; - io_object:se -> io_service:n [ label="5" ]; - your_program:s -> io_object:ne [ label="6" ]; - } - } -} diff --git a/boost-asio/doc/overview/sync_op.png b/boost-asio/doc/overview/sync_op.png deleted file mode 100644 index 12324631b..000000000 Binary files a/boost-asio/doc/overview/sync_op.png and /dev/null differ diff --git a/boost-asio/doc/overview/threads.qbk b/boost-asio/doc/overview/threads.qbk deleted file mode 100644 index 022a100c6..000000000 --- a/boost-asio/doc/overview/threads.qbk +++ /dev/null @@ -1,67 +0,0 @@ -[/ - / Copyright (c) 2003-2018 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:threads Threads and Boost.Asio] - -[heading Thread Safety] - -In general, it is safe to make concurrent use of distinct objects, but unsafe -to make concurrent use of a single object. However, types such as `io_context` -provide a stronger guarantee that it is safe to use a single object -concurrently. - -[heading Thread Pools] - -Multiple threads may call `io_context::run()` to set up a pool of threads from -which completion handlers may be invoked. This approach may also be used with -`post()` as a means to perform arbitrary computational tasks across a thread -pool. - -Note that all threads that have joined an `io_context`'s pool are considered -equivalent, and the `io_context` 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 -one or more internal threads to emulate asynchronicity. As far as possible, -these threads must be invisible to the library user. In particular, the threads: - -* must not call the user's code directly; and - -* must block all signals. - -This approach is complemented by the following guarantee: - -* Asynchronous completion handlers will only be called from threads that are - currently calling `io_context::run()`. - -Consequently, it is the library user's responsibility to create and manage all -threads to which the notifications will be delivered. - -The reasons for this approach include: - -* By only calling `io_context::run()` from a single thread, the user's code can - avoid the development complexity associated with synchronisation. For - example, a library user can implement scalable servers that are - single-threaded (from the user's point of view). - -* A library user may need to perform initialisation in a thread shortly after - the thread starts and before any other application code is executed. For - example, users of Microsoft's COM must call `CoInitializeEx` before any other - COM operations can be called from that thread. - -* The library interface is decoupled from interfaces for thread creation and - management, and permits implementations on platforms where threads are not - available. - -[heading See Also] - -[link boost_asio.reference.io_context io_context], -[link boost_asio.reference.post post]. - -[endsect] diff --git a/boost-asio/doc/overview/timers.qbk b/boost-asio/doc/overview/timers.qbk deleted file mode 100644 index 61bf400a5..000000000 --- a/boost-asio/doc/overview/timers.qbk +++ /dev/null @@ -1,52 +0,0 @@ -[/ - / Copyright (c) 2003-2018 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:timers Timers] - -Long running I/O operations will often have a deadline by which they must have -completed. These deadlines may be expressed as absolute times, but are often -calculated relative to the current time. - -As a simple example, to perform a synchronous wait operation on a timer using a -relative time one may write: - - io_context i; - ... - deadline_timer t(i); - t.expires_from_now(boost::posix_time::seconds(5)); - t.wait(); - -More commonly, a program will perform an asynchronous wait operation on a -timer: - - void handler(boost::system::error_code ec) { ... } - ... - io_context i; - ... - deadline_timer t(i); - t.expires_from_now(boost::posix_time::milliseconds(400)); - t.async_wait(handler); - ... - i.run(); - -The deadline associated with a timer may also be obtained as a relative time: - - boost::posix_time::time_duration time_until_expiry - = t.expires_from_now(); - -or as an absolute time to allow composition of timers: - - deadline_timer t2(i); - t2.expires_at(t.expires_at() + boost::posix_time::seconds(30)); - -[heading See Also] - -[link boost_asio.reference.basic_deadline_timer basic_deadline_timer], -[link boost_asio.reference.deadline_timer deadline_timer], -[link boost_asio.tutorial.tuttimer1 timer tutorials]. - -[endsect] diff --git a/boost-asio/doc/overview/windows.qbk b/boost-asio/doc/overview/windows.qbk deleted file mode 100644 index 0a2fabdd8..000000000 --- a/boost-asio/doc/overview/windows.qbk +++ /dev/null @@ -1,126 +0,0 @@ -[/ - / Copyright (c) 2003-2018 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:windows Windows-Specific Functionality] - -[link boost_asio.overview.windows.stream_handle Stream-Oriented HANDLEs] - -[link boost_asio.overview.windows.random_access_handle Random-Access HANDLEs] - -[link boost_asio.overview.windows.object_handle Object HANDLEs] - -[section:stream_handle Stream-Oriented HANDLEs] - -Boost.Asio contains classes to allow asynchronous read and write operations to be -performed on Windows `HANDLE`s, such as named pipes. - -For example, to perform asynchronous operations on a named pipe, the following -object may be created: - - HANDLE handle = ::CreateFile(...); - windows::stream_handle pipe(my_io_context, handle); - -These are then used as synchronous or asynchronous read and write streams. This -means the objects can be used with any of the [link boost_asio.reference.read -read()], [link boost_asio.reference.async_read async_read()], [link -boost_asio.reference.write write()], [link boost_asio.reference.async_write -async_write()], [link boost_asio.reference.read_until read_until()] or [link -boost_asio.reference.async_read_until async_read_until()] free functions. - -The kernel object referred to by the `HANDLE` must support use with I/O -completion ports (which means that named pipes are supported, but anonymous -pipes and console streams are not). - -[heading See Also] - -[link boost_asio.reference.windows__stream_handle windows::stream_handle]. - -[heading Notes] - -Windows stream `HANDLE`s are only available at compile time when targeting -Windows and only when the I/O completion port backend is used (which is the -default). A program may test for the macro `BOOST_ASIO_HAS_WINDOWS_STREAM_HANDLE` to -determine whether they are supported. - -[endsect] - -[/-----------------------------------------------------------------------------] - -[section:random_access_handle Random-Access HANDLEs] - -Boost.Asio provides Windows-specific classes that permit asynchronous read and write -operations to be performed on HANDLEs that refer to regular files. - -For example, to perform asynchronous operations on a file the following object -may be created: - - HANDLE handle = ::CreateFile(...); - windows::random_access_handle file(my_io_context, handle); - -Data may be read from or written to the handle using one of the -`read_some_at()`, `async_read_some_at()`, `write_some_at()` or -`async_write_some_at()` member functions. However, like the equivalent -functions (`read_some()`, etc.) on streams, these functions are only required -to transfer one or more bytes in a single operation. Therefore free functions -called [link boost_asio.reference.read_at read_at()], [link -boost_asio.reference.async_read_at async_read_at()], [link boost_asio.reference.write_at -write_at()] and [link boost_asio.reference.async_write_at async_write_at()] have been -created to repeatedly call the corresponding [^[**]_some_at()] function until -all data has been transferred. - -[heading See Also] - -[link boost_asio.reference.windows__random_access_handle windows::random_access_handle]. - -[heading Notes] - -Windows random-access `HANDLE`s are only available at compile time when -targeting Windows and only when the I/O completion port backend is used (which -is the default). A program may test for the macro -`BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE` to determine whether they are -supported. - -[endsect] - -[/-----------------------------------------------------------------------------] - -[section:object_handle Object HANDLEs] - -Boost.Asio provides Windows-specific classes that permit asynchronous wait operations -to be performed on HANDLEs to kernel objects of the following types: - -* Change notification -* Console input -* Event -* Memory resource notification -* Process -* Semaphore -* Thread -* Waitable timer - -For example, to perform asynchronous operations on an event, the following -object may be created: - - HANDLE handle = ::CreateEvent(...); - windows::object_handle file(my_io_context, handle); - -The `wait()` and `async_wait()` member functions may then be used to wait until -the kernel object is signalled. - -[heading See Also] - -[link boost_asio.reference.windows__object_handle windows::object_handle]. - -[heading Notes] - -Windows object `HANDLE`s are only available at compile time when targeting -Windows. Programs may test for the macro `BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE` to -determine whether they are supported. - -[endsect] - -[endsect] diff --git a/boost-asio/doc/quickref.xml b/boost-asio/doc/quickref.xml deleted file mode 100644 index 968fb763c..000000000 --- a/boost-asio/doc/quickref.xml +++ /dev/null @@ -1,538 +0,0 @@ - - - - - - - - - - - - - - - Core - - - - - - - Classes - - coroutine - execution_context - execution_context::id - execution_context::service - executor - executor_arg_t - invalid_service_owner - io_context - io_context::executor_type - io_context::service - io_context::strand - io_context::work (deprecated) - service_already_exists - system_executor - thread_pool - thread_pool::executor_type - yield_context - - - - Free Functions - - add_service - asio_handler_allocate - asio_handler_deallocate - asio_handler_invoke - asio_handler_is_continuation - bind_executor - dispatch - defer - get_associated_allocator - get_associated_executor - has_service - make_work_guard - post - spawn - use_service - - - - Class Templates - - async_completion - basic_io_object - basic_yield_context - executor_binder - executor_work_guard - strand - use_future_t - - Special Values - - executor_arg - use_future - - Boost.Bind Placeholders - - placeholders::bytes_transferred - placeholders::endpoint - placeholders::error - placeholders::iterator - placeholders::results - placeholders::signal_number - - - - Error Codes - - error::basic_errors - error::netdb_errors - error::addrinfo_errors - error::misc_errors - - Type Traits - - associated_allocator - associated_executor - async_result - handler_type (deprecated) - is_executor - uses_executor - - Type Requirements - - Asynchronous operations - CompletionHandler - ExecutionContext - Executor - Handler - Service - - - - - - - - - - - - - - Buffers and Buffer-Oriented Operations - - - - - - - Classes - - const_buffer - mutable_buffer - const_buffers_1 (deprecated) - mutable_buffers_1 (deprecated) - null_buffers (deprecated) - streambuf - - Class Templates - - basic_streambuf - buffered_read_stream - buffered_stream - buffered_write_stream - buffers_iterator - dynamic_string_buffer - dynamic_vector_buffer - - - - Free Functions - - async_read - async_read_at - async_read_until - async_write - async_write_at - buffer - buffer_cast (deprecated) - buffer_copy - buffer_size - buffers_begin - buffers_end - dynamic_buffer - read - read_at - read_until - transfer_all - transfer_at_least - transfer_exactly - write - write_at - - - - Type Traits - - is_const_buffer_sequence - is_match_condition - is_mutable_buffer_sequence - is_read_buffered - is_write_buffered - - - - Type Requirements - - Read and write operations - AsyncRandomAccessReadDevice - AsyncRandomAccessWriteDevice - AsyncReadStream - AsyncWriteStream - CompletionCondition - ConstBufferSequence - DynamicBuffer - MutableBufferSequence - ReadHandler - SyncRandomAccessReadDevice - SyncRandomAccessWriteDevice - SyncReadStream - SyncWriteStream - WriteHandler - - - - - - - - - - - - - - Networking - - - - - - - Classes - - generic::datagram_protocol - generic::datagram_protocol::endpoint - generic::datagram_protocol::socket - generic::raw_protocol - generic::raw_protocol::endpoint - generic::raw_protocol::socket - generic::seq_packet_protocol - generic::seq_packet_protocol::endpoint - generic::seq_packet_protocol::socket - generic::stream_protocol - generic::stream_protocol::endpoint - generic::stream_protocol::iostream - generic::stream_protocol::socket - ip::address - ip::address_v4 - ip::address_v4_iterator - ip::address_v4_range - ip::address_v6 - ip::address_v6_iterator - ip::address_v6_range - ip::icmp - ip::icmp::endpoint - ip::icmp::resolver - ip::icmp::socket - ip::network_v4 - ip::network_v6 - ip::resolver_query_base - ip::tcp - ip::tcp::acceptor - ip::tcp::endpoint - ip::tcp::iostream - ip::tcp::resolver - ip::tcp::socket - ip::udp - ip::udp::endpoint - ip::udp::resolver - ip::udp::socket - socket_base - - - - Free Functions - - async_connect - connect - ip::host_name - ip::make_address - ip::make_address_v4 - ip::make_address_v6 - ip::make_network_v4 - ip::make_network_v6 - - Class Templates - - basic_datagram_socket - basic_raw_socket - basic_seq_packet_socket - basic_socket - basic_socket_acceptor - basic_socket_iostream - basic_socket_streambuf - basic_stream_socket - generic::basic_endpoint - ip::basic_endpoint - ip::basic_resolver - ip::basic_resolver_entry - ip::basic_resolver_iterator - ip::basic_resolver_query - - - - Socket Options - - ip::multicast::enable_loopback - ip::multicast::hops - ip::multicast::join_group - ip::multicast::leave_group - ip::multicast::outbound_interface - ip::tcp::no_delay - ip::unicast::hops - ip::v6_only - socket_base::broadcast - socket_base::debug - socket_base::do_not_route - socket_base::enable_connection_aborted - socket_base::keep_alive - socket_base::linger - socket_base::receive_buffer_size - socket_base::receive_low_watermark - socket_base::reuse_address - socket_base::send_buffer_size - socket_base::send_low_watermark - - - - I/O Control Commands - - socket_base::bytes_readable - - Type Requirements - - Synchronous socket operations - Asynchronous socket operations - AcceptableProtocol - AcceptHandler - ConnectCondition - ConnectHandler - Endpoint - EndpointSequence - GettableSocketOption - InternetProtocol - IoControlCommand - IteratorConnectHandler - MoveAcceptHandler - Protocol - RangeConnectHandler - ResolveHandler - SettableSocketOption - - - - - - - - - - - - - - Timers - - - SSL - - - Serial Ports - - - Signal Handling - - - - - - - Classes - - deadline_timer - high_resolution_timer - steady_timer - system_timer - - Class Templates - - basic_deadline_timer - basic_waitable_timer - time_traits - wait_traits - - Type Requirements - - TimeTraits - WaitHandler - WaitTraits - - - - Classes - - ssl::context - ssl::context_base - ssl::rfc2818_verification - ssl::stream_base - ssl::verify_context - - Class Templates - - ssl::stream - - Type Requirements - - BufferedHandshakeHandler - HandshakeHandler - ShutdownHandler - - - - Classes - - serial_port - serial_port_base - - Serial Port Options - - serial_port_base::baud_rate - serial_port_base::flow_control - serial_port_base::parity - serial_port_base::stop_bits - serial_port_base::character_size - - Type Requirements - - GettableSerialPortOption - SettableSerialPortOption - - - - Classes - - signal_set - - Type Requirements - - SignalHandler - - - - - - - - - - - - - - POSIX-specific - - - Windows-specific - - - Experimental - - - - - - - Classes - - local::stream_protocol - local::stream_protocol::acceptor - local::stream_protocol::endpoint - local::stream_protocol::iostream - local::stream_protocol::socket - local::datagram_protocol - local::datagram_protocol::endpoint - local::datagram_protocol::socket - posix::descriptor - posix::descriptor_base - posix::stream_descriptor - - - - Free Functions - - local::connect_pair - - Class Templates - - local::basic_endpoint - - - - Classes - - windows::object_handle - windows::overlapped_handle - windows::overlapped_ptr - windows::random_access_handle - windows::stream_handle - - - - Classes - - experimental::detached_t - experimental::this_coro::executor_t - experimental::this_coro::token_t - - Class Templates - - experimental::awaitable - experimental::await_token - experimental::redirect_error_t - - Free Functions - - experimental::co_spawn - experimental::this_coro::executor - experimental::this_coro::token - - Special Values - - experimental::detached - - - - - - diff --git a/boost-asio/doc/reference.dox b/boost-asio/doc/reference.dox deleted file mode 100644 index f45b9a7bb..000000000 --- a/boost-asio/doc/reference.dox +++ /dev/null @@ -1,258 +0,0 @@ -# Doxyfile 1.4.5 - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = "Boost.Asio Reference" -PROJECT_NUMBER = -OUTPUT_DIRECTORY = . -CREATE_SUBDIRS = NO -OUTPUT_LANGUAGE = English -USE_WINDOWS_ENCODING = NO -BRIEF_MEMBER_DESC = YES -REPEAT_BRIEF = YES -ABBREVIATE_BRIEF = -ALWAYS_DETAILED_SEC = YES -INLINE_INHERITED_MEMB = YES -FULL_PATH_NAMES = YES -STRIP_FROM_PATH = ./../../../ -STRIP_FROM_INC_PATH = -SHORT_NAMES = NO -JAVADOC_AUTOBRIEF = NO -MULTILINE_CPP_IS_BRIEF = YES -DETAILS_AT_TOP = YES -INHERIT_DOCS = NO -SEPARATE_MEMBER_PAGES = NO -TAB_SIZE = 2 -ALIASES = -OPTIMIZE_OUTPUT_FOR_C = NO -OPTIMIZE_OUTPUT_JAVA = NO -BUILTIN_STL_SUPPORT = NO -DISTRIBUTE_GROUP_DOC = NO -SUBGROUPING = YES -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- -EXTRACT_ALL = YES -EXTRACT_PRIVATE = YES -EXTRACT_STATIC = YES -EXTRACT_LOCAL_CLASSES = NO -EXTRACT_LOCAL_METHODS = NO -HIDE_UNDOC_MEMBERS = YES -HIDE_UNDOC_CLASSES = YES -HIDE_FRIEND_COMPOUNDS = NO -HIDE_IN_BODY_DOCS = NO -INTERNAL_DOCS = NO -CASE_SENSE_NAMES = YES -HIDE_SCOPE_NAMES = NO -SHOW_INCLUDE_FILES = NO -INLINE_INFO = NO -SORT_MEMBER_DOCS = NO -SORT_BRIEF_DOCS = NO -SORT_BY_SCOPE_NAME = NO -GENERATE_TODOLIST = NO -GENERATE_TESTLIST = NO -GENERATE_BUGLIST = NO -GENERATE_DEPRECATEDLIST= NO -ENABLED_SECTIONS = -MAX_INITIALIZER_LINES = 30 -SHOW_USED_FILES = NO -SHOW_DIRECTORIES = NO -FILE_VERSION_FILTER = -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- -QUIET = NO -WARNINGS = YES -WARN_IF_UNDOCUMENTED = YES -WARN_IF_DOC_ERROR = YES -WARN_NO_PARAMDOC = NO -WARN_FORMAT = "$file:$line: $text" -WARN_LOGFILE = -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = ./../../../boost/asio.hpp \ - ./../../../boost/asio \ - ./../../../boost/asio/experimental \ - ./../../../boost/asio/generic \ - ./../../../boost/asio/impl \ - ./../../../boost/asio/ip \ - ./../../../boost/asio/local \ - ./../../../boost/asio/posix \ - ./../../../boost/asio/ssl \ - ./../../../boost/asio/windows \ - ./noncopyable_dox.txt \ - ./std_exception_dox.txt -FILE_PATTERNS = -RECURSIVE = NO -EXCLUDE = -EXCLUDE_SYMLINKS = NO -EXCLUDE_PATTERNS = -EXAMPLE_PATH = -EXAMPLE_PATTERNS = -EXAMPLE_RECURSIVE = YES -IMAGE_PATH = -INPUT_FILTER = -FILTER_PATTERNS = -FILTER_SOURCE_FILES = NO -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- -SOURCE_BROWSER = NO -INLINE_SOURCES = NO -STRIP_CODE_COMMENTS = YES -REFERENCED_BY_RELATION = NO -REFERENCES_RELATION = NO -USE_HTAGS = NO -VERBATIM_HEADERS = NO -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- -ALPHABETICAL_INDEX = YES -COLS_IN_ALPHA_INDEX = 1 -IGNORE_PREFIX = -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- -GENERATE_HTML = NO -HTML_OUTPUT = . -HTML_FILE_EXTENSION = .html -HTML_HEADER = -HTML_FOOTER = -HTML_STYLESHEET = -HTML_ALIGN_MEMBERS = YES -GENERATE_HTMLHELP = NO -CHM_FILE = -HHC_LOCATION = -GENERATE_CHI = NO -BINARY_TOC = NO -TOC_EXPAND = NO -DISABLE_INDEX = YES -ENUM_VALUES_PER_LINE = 1 -GENERATE_TREEVIEW = NO -TREEVIEW_WIDTH = 250 -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- -GENERATE_LATEX = NO -LATEX_OUTPUT = latex -LATEX_CMD_NAME = latex -MAKEINDEX_CMD_NAME = makeindex -COMPACT_LATEX = NO -PAPER_TYPE = a4wide -EXTRA_PACKAGES = -LATEX_HEADER = -PDF_HYPERLINKS = NO -USE_PDFLATEX = NO -LATEX_BATCHMODE = NO -LATEX_HIDE_INDICES = NO -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- -GENERATE_RTF = NO -RTF_OUTPUT = rtf -COMPACT_RTF = NO -RTF_HYPERLINKS = NO -RTF_STYLESHEET_FILE = -RTF_EXTENSIONS_FILE = -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- -GENERATE_MAN = NO -MAN_OUTPUT = man -MAN_EXTENSION = .3 -MAN_LINKS = NO -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- -GENERATE_XML = YES -XML_OUTPUT = xml -XML_SCHEMA = -XML_DTD = -XML_PROGRAMLISTING = NO -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- -GENERATE_AUTOGEN_DEF = NO -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- -GENERATE_PERLMOD = NO -PERLMOD_LATEX = NO -PERLMOD_PRETTY = YES -PERLMOD_MAKEVAR_PREFIX = -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- -ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = YES -EXPAND_ONLY_PREDEF = YES -SEARCH_INCLUDES = YES -INCLUDE_PATH = -INCLUDE_FILE_PATTERNS = -PREDEFINED = GENERATING_DOCUMENTATION \ - BOOST_ASIO_SOCKET_ERROR(e)=implementation_defined \ - BOOST_ASIO_NETDB_ERROR(e)=implementation_defined \ - BOOST_ASIO_EOF_ERROR(e)=implementation_defined \ - BOOST_ASIO_OS_ERROR(e1,e2)=implementation_defined \ - BOOST_ASIO_MOVE_ARG(a)=a&& \ - BOOST_ASIO_DECL= \ - BOOST_ASIO_CONSTEXPR=constexpr \ - BOOST_ASIO_NOEXCEPT=noexcept \ - BOOST_ASIO_INITFN_RESULT_TYPE(t,a)=void_or_deduced \ - BOOST_ASIO_SVC_TPARAM= \ - BOOST_ASIO_SVC_TPARAM_DEF1()= \ - BOOST_ASIO_SVC_TPARAM_DEF2()= \ - BOOST_ASIO_SVC_TARG= \ - BOOST_ASIO_SVC_TPARAM1= \ - BOOST_ASIO_SVC_TPARAM1_DEF1()= \ - BOOST_ASIO_SVC_TPARAM1_DEF2()= \ - BOOST_ASIO_SVC_TARG1= \ - BOOST_ASIO_SVC_T=asio::detail::service \ - BOOST_ASIO_SVC_T1=asio::detail::service \ - BOOST_ASIO_CONST_BUFFER=const_buffer \ - BOOST_ASIO_MUTABLE_BUFFER=mutable_buffer \ - BOOST_ASIO_SYNC_OP_VOID=void \ - BOOST_ASIO_STRING_VIEW_PARAM=string_view \ - BOOST_ASIO_UNUSED_VARIABLE= -EXPAND_AS_DEFINED = -SKIP_FUNCTION_MACROS = YES -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- -TAGFILES = -GENERATE_TAGFILE = reference.tags -ALLEXTERNALS = NO -EXTERNAL_GROUPS = YES -PERL_PATH = /usr/bin/perl -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- -CLASS_DIAGRAMS = NO -HIDE_UNDOC_RELATIONS = YES -HAVE_DOT = YES -CLASS_GRAPH = YES -COLLABORATION_GRAPH = NO -GROUP_GRAPHS = NO -UML_LOOK = NO -TEMPLATE_RELATIONS = YES -INCLUDE_GRAPH = NO -INCLUDED_BY_GRAPH = NO -CALL_GRAPH = NO -GRAPHICAL_HIERARCHY = NO -DIRECTORY_GRAPH = NO -DOT_IMAGE_FORMAT = png -DOT_PATH = -DOTFILE_DIRS = -MAX_DOT_GRAPH_WIDTH = 640 -MAX_DOT_GRAPH_HEIGHT = 640 -MAX_DOT_GRAPH_DEPTH = 0 -DOT_TRANSPARENT = NO -DOT_MULTI_TARGETS = NO -GENERATE_LEGEND = NO -DOT_CLEANUP = YES -#--------------------------------------------------------------------------- -# Configuration::additions related to the search engine -#--------------------------------------------------------------------------- -SEARCHENGINE = NO diff --git a/boost-asio/doc/reference.qbk b/boost-asio/doc/reference.qbk deleted file mode 100644 index 7e1272b9a..000000000 --- a/boost-asio/doc/reference.qbk +++ /dev/null @@ -1,113723 +0,0 @@ -[/ - / Copyright (c) 2003-2018 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:reference Reference] - -[xinclude quickref.xml] - -[include requirements/asynchronous_operations.qbk] -[include requirements/read_write_operations.qbk] -[include requirements/synchronous_socket_operations.qbk] -[include requirements/asynchronous_socket_operations.qbk] -[include requirements/AcceptableProtocol.qbk] -[include requirements/AcceptHandler.qbk] -[include requirements/AsyncRandomAccessReadDevice.qbk] -[include requirements/AsyncRandomAccessWriteDevice.qbk] -[include requirements/AsyncReadStream.qbk] -[include requirements/AsyncWriteStream.qbk] -[include requirements/BufferedHandshakeHandler.qbk] -[include requirements/CompletionCondition.qbk] -[include requirements/CompletionHandler.qbk] -[include requirements/ConnectCondition.qbk] -[include requirements/ConnectHandler.qbk] -[include requirements/ConstBufferSequence.qbk] -[include requirements/DynamicBuffer.qbk] -[include requirements/Endpoint.qbk] -[include requirements/EndpointSequence.qbk] -[include requirements/ExecutionContext.qbk] -[include requirements/Executor.qbk] -[include requirements/GettableSerialPortOption.qbk] -[include requirements/GettableSocketOption.qbk] -[include requirements/Handler.qbk] -[include requirements/HandshakeHandler.qbk] -[include requirements/InternetProtocol.qbk] -[include requirements/IoControlCommand.qbk] -[include requirements/IoObjectService.qbk] -[include requirements/IteratorConnectHandler.qbk] -[include requirements/LegacyCompletionHandler.qbk] -[include requirements/MoveAcceptHandler.qbk] -[include requirements/MutableBufferSequence.qbk] -[include requirements/ProtoAllocator.qbk] -[include requirements/Protocol.qbk] -[include requirements/RangeConnectHandler.qbk] -[include requirements/ReadHandler.qbk] -[include requirements/ResolveHandler.qbk] -[include requirements/Service.qbk] -[include requirements/SettableSerialPortOption.qbk] -[include requirements/SettableSocketOption.qbk] -[include requirements/ShutdownHandler.qbk] -[include requirements/SignalHandler.qbk] -[include requirements/SyncRandomAccessReadDevice.qbk] -[include requirements/SyncRandomAccessWriteDevice.qbk] -[include requirements/SyncReadStream.qbk] -[include requirements/SyncWriteStream.qbk] -[include requirements/TimeTraits.qbk] -[include requirements/WaitHandler.qbk] -[include requirements/WaitTraits.qbk] -[include requirements/WriteHandler.qbk] - - - -[section:add_service add_service] - -[indexterm1 boost_asio.indexterm.add_service..add_service] - - template< - typename ``[link boost_asio.reference.Service Service]``> - void add_service( - execution_context & e, - Service * svc); - - -This function is used to add a service to the [link boost_asio.reference.execution_context `execution_context`]. - - -[heading Parameters] - - -[variablelist - -[[e][The [link boost_asio.reference.execution_context `execution_context`] object that owns the service.]] - -[[svc][The service object. On success, ownership of the service object is transferred to the [link boost_asio.reference.execution_context `execution_context`]. When the [link boost_asio.reference.execution_context `execution_context`] object is destroyed, it will destroy the service object by performing: -`` - delete static_cast(svc) -`` -]] - -] - - -[heading Exceptions] - - -[variablelist - -[[boost::asio::service_already_exists][Thrown if a service of the given type is already present in the [link boost_asio.reference.execution_context `execution_context`].]] - -[[boost::asio::invalid_service_owner][Thrown if the service's owning [link boost_asio.reference.execution_context `execution_context`] is not the [link boost_asio.reference.execution_context `execution_context`] object specified by the `e` parameter. ]] - -] - - - -[heading Requirements] - -['Header: ][^boost/asio/impl/execution_context.hpp] - -['Convenience header: ][^boost/asio.hpp] - - -[endsect] - - - -[section:asio_handler_allocate asio_handler_allocate] - -[indexterm1 boost_asio.indexterm.asio_handler_allocate..asio_handler_allocate] -Default allocation function for handlers. - - - void * asio_handler_allocate( - std::size_t size, - ... ); - - -Asynchronous operations may need to allocate temporary objects. Since asynchronous operations have a handler function object, these temporary objects can be said to be associated with the handler. - -Implement asio\_handler\_allocate and asio\_handler\_deallocate for your own handlers to provide custom allocation for these temporary objects. - -The default implementation of these allocation hooks uses `operator new` and `operator delete`. - - -[heading Remarks] - -All temporary objects associated with a handler will be deallocated before the upcall to the handler is performed. This allows the same memory to be reused for a subsequent asynchronous operation initiated by the handler. - - -[heading Example] - - - - class my_handler; - - void* asio_handler_allocate(std::size_t size, my_handler* context) - { - return ::operator new(size); - } - - void asio_handler_deallocate(void* pointer, std::size_t size, - my_handler* context) - { - ::operator delete(pointer); - } - - - - - - -[heading Requirements] - -['Header: ][^boost/asio/handler_alloc_hook.hpp] - -['Convenience header: ][^boost/asio.hpp] - - -[endsect] - - - -[section:asio_handler_deallocate asio_handler_deallocate] - -[indexterm1 boost_asio.indexterm.asio_handler_deallocate..asio_handler_deallocate] -Default deallocation function for handlers. - - - void asio_handler_deallocate( - void * pointer, - std::size_t size, - ... ); - - -Implement asio\_handler\_allocate and asio\_handler\_deallocate for your own handlers to provide custom allocation for the associated temporary objects. - -The default implementation of these allocation hooks uses `operator new` and `operator delete`. - - - - -[heading Requirements] - -['Header: ][^boost/asio/handler_alloc_hook.hpp] - -['Convenience header: ][^boost/asio.hpp] - - -[endsect] - - -[section:asio_handler_invoke asio_handler_invoke] - -[indexterm1 boost_asio.indexterm.asio_handler_invoke..asio_handler_invoke] -Default invoke function for handlers. - - - template< - typename Function> - void ``[link boost_asio.reference.asio_handler_invoke.overload1 asio_handler_invoke]``( - Function & function, - ... ); - `` [''''»''' [link boost_asio.reference.asio_handler_invoke.overload1 more...]]`` - - template< - typename Function> - void ``[link boost_asio.reference.asio_handler_invoke.overload2 asio_handler_invoke]``( - const Function & function, - ... ); - `` [''''»''' [link boost_asio.reference.asio_handler_invoke.overload2 more...]]`` - -Completion handlers for asynchronous operations are invoked by the [link boost_asio.reference.io_context `io_context`] associated with the corresponding object (e.g. a socket or deadline\_timer). Certain guarantees are made on when the handler may be invoked, in particular that a handler can only be invoked from a thread that is currently calling `run()` on the corresponding [link boost_asio.reference.io_context `io_context`] object. Handlers may subsequently be invoked through other objects (such as [link boost_asio.reference.io_context__strand `io_context::strand`] objects) that provide additional guarantees. - -When asynchronous operations are composed from other asynchronous operations, all intermediate handlers should be invoked using the same method as the final handler. This is required to ensure that user-defined objects are not accessed in a way that may violate the guarantees. This hooking function ensures that the invoked method used for the final handler is accessible at each intermediate step. - -Implement asio\_handler\_invoke for your own handlers to specify a custom invocation strategy. - -This default implementation invokes the function object like so: - - function(); - - -If necessary, the default implementation makes a copy of the function object so that the non-const operator() can be used. - - -[heading Example] - - - - class my_handler; - - template - void asio_handler_invoke(Function function, my_handler* context) - { - context->strand_.dispatch(function); - } - - - - - - -[heading Requirements] - -['Header: ][^boost/asio/handler_invoke_hook.hpp] - -['Convenience header: ][^boost/asio.hpp] - - -[section:overload1 asio_handler_invoke (1 of 2 overloads)] - - -Default handler invocation hook used for non-const function objects. - - - template< - typename Function> - void asio_handler_invoke( - Function & function, - ... ); - - - -[endsect] - - - -[section:overload2 asio_handler_invoke (2 of 2 overloads)] - - -Default handler invocation hook used for const function objects. - - - template< - typename Function> - void asio_handler_invoke( - const Function & function, - ... ); - - - -[endsect] - - -[endsect] - - -[section:asio_handler_is_continuation asio_handler_is_continuation] - -[indexterm1 boost_asio.indexterm.asio_handler_is_continuation..asio_handler_is_continuation] -Default continuation function for handlers. - - - bool asio_handler_is_continuation( - ... ); - - -Asynchronous operations may represent a continuation of the asynchronous control flow associated with the current handler. The implementation can use this knowledge to optimise scheduling of the handler. - -Implement asio\_handler\_is\_continuation for your own handlers to indicate when a handler represents a continuation. - -The default implementation of the continuation hook returns `false`. - - -[heading Example] - - - - class my_handler; - - bool asio_handler_is_continuation(my_handler* context) - { - return true; - } - - - - - - -[heading Requirements] - -['Header: ][^boost/asio/handler_continuation_hook.hpp] - -['Convenience header: ][^boost/asio.hpp] - - -[endsect] - - -[section:associated_allocator associated_allocator] - - -Traits type used to obtain the allocator associated with an object. - - - template< - typename T, - typename Allocator = std::allocator> - struct associated_allocator - - -[heading Types] -[table - [[Name][Description]] - - [ - - [[link boost_asio.reference.associated_allocator.type [*type]]] - [If T has a nested type allocator_type, T::allocator_type. Otherwise Allocator. ] - - ] - -] - -[heading Member Functions] -[table - [[Name][Description]] - - [ - [[link boost_asio.reference.associated_allocator.get [*get]]] - [If T has a nested type allocator_type, returns t.get_allocator(). Otherwise returns a. ] - ] - -] - -A program may specialise this traits type if the `T` template parameter in the specialisation is a user-defined type. The template parameter `Allocator` shall be a type meeting the Allocator requirements. - -Specialisations shall meet the following requirements, where `t` is a const reference to an object of type `T`, and `a` is an object of type `Allocator`. - - -* Provide a nested typedef `type` that identifies a type meeting the Allocator requirements. - - -* Provide a noexcept static member function named `get`, callable as `get(t)` and with return type `type`. - - -* Provide a noexcept static member function named `get`, callable as `get(t,a)` and with return type `type`. - - - -[heading Requirements] - -['Header: ][^boost/asio/associated_allocator.hpp] - -['Convenience header: ][^boost/asio.hpp] - - -[section:get associated_allocator::get] - -[indexterm2 boost_asio.indexterm.associated_allocator.get..get..associated_allocator] -If `T` has a nested type `allocator_type`, returns `t.get_allocator()`. Otherwise returns `a`. - - - static type get( - const T & t, - const Allocator & a = Allocator()); - - - -[endsect] - - - -[section:type associated_allocator::type] - -[indexterm2 boost_asio.indexterm.associated_allocator.type..type..associated_allocator] -If `T` has a nested type `allocator_type`, `T::allocator_type`. Otherwise `Allocator`. - - - typedef see_below type; - - - -[heading Requirements] - -['Header: ][^boost/asio/associated_allocator.hpp] - -['Convenience header: ][^boost/asio.hpp] - - -[endsect] - - - -[endsect] - -[section:associated_executor associated_executor] - - -Traits type used to obtain the executor associated with an object. - - - template< - typename T, - typename ``[link boost_asio.reference.Executor1 Executor]`` = system_executor> - struct associated_executor - - -[heading Types] -[table - [[Name][Description]] - - [ - - [[link boost_asio.reference.associated_executor.type [*type]]] - [If T has a nested type executor_type, T::executor_type. Otherwise Executor. ] - - ] - -] - -[heading Member Functions] -[table - [[Name][Description]] - - [ - [[link boost_asio.reference.associated_executor.get [*get]]] - [If T has a nested type executor_type, returns t.get_executor(). Otherwise returns ex. ] - ] - -] - -A program may specialise this traits type if the `T` template parameter in the specialisation is a user-defined type. The template parameter `Executor` shall be a type meeting the Executor requirements. - -Specialisations shall meet the following requirements, where `t` is a const reference to an object of type `T`, and `e` is an object of type `Executor`. - - -* Provide a nested typedef `type` that identifies a type meeting the Executor requirements. - - -* Provide a noexcept static member function named `get`, callable as `get(t)` and with return type `type`. - - -* Provide a noexcept static member function named `get`, callable as `get(t,e)` and with return type `type`. - - - -[heading Requirements] - -['Header: ][^boost/asio/associated_executor.hpp] - -['Convenience header: ][^boost/asio.hpp] - - -[section:get associated_executor::get] - -[indexterm2 boost_asio.indexterm.associated_executor.get..get..associated_executor] -If `T` has a nested type `executor_type`, returns `t.get_executor()`. Otherwise returns `ex`. - - - static type get( - const T & t, - const Executor & ex = Executor()); - - - -[endsect] - - - -[section:type associated_executor::type] - -[indexterm2 boost_asio.indexterm.associated_executor.type..type..associated_executor] -If `T` has a nested type `executor_type`, `T::executor_type`. Otherwise `Executor`. - - - typedef see_below type; - - - -[heading Requirements] - -['Header: ][^boost/asio/associated_executor.hpp] - -['Convenience header: ][^boost/asio.hpp] - - -[endsect] - - - -[endsect] - -[section:async_completion async_completion] - - -Helper template to deduce the handler type from a CompletionToken, capture a local copy of the handler, and then create an [link boost_asio.reference.async_result `async_result`] for the handler. - - - template< - typename CompletionToken, - typename Signature> - struct async_completion - - -[heading Types] -[table - [[Name][Description]] - - [ - - [[link boost_asio.reference.async_completion.completion_handler_type [*completion_handler_type]]] - [The real handler type to be used for the asynchronous operation. ] - - ] - -] - -[heading Member Functions] -[table - [[Name][Description]] - - [ - [[link boost_asio.reference.async_completion.async_completion [*async_completion]]] - [Constructor. ] - ] - -] - -[heading Data Members] -[table - [[Name][Description]] - - [ - [[link boost_asio.reference.async_completion.completion_handler [*completion_handler]]] - [A copy of, or reference to, a real handler object. ] - ] - - [ - [[link boost_asio.reference.async_completion.result [*result]]] - [The result of the asynchronous operation's initiating function. ] - ] - -] - -[heading Requirements] - -['Header: ][^boost/asio/async_result.hpp] - -['Convenience header: ][^boost/asio.hpp] - - -[section:async_completion async_completion::async_completion] - -[indexterm2 boost_asio.indexterm.async_completion.async_completion..async_completion..async_completion] -Constructor. - - - async_completion( - CompletionToken & token); - - -The constructor creates the concrete completion handler and makes the link between the handler and the asynchronous result. - - -[endsect] - - - -[section:completion_handler async_completion::completion_handler] - -[indexterm2 boost_asio.indexterm.async_completion.completion_handler..completion_handler..async_completion] -A copy of, or reference to, a real handler object. - - - conditional< is_same< CompletionToken, completion_handler_type >::value, completion_handler_type &, completion_handler_type >::type completion_handler; - - - -[endsect] - - - -[section:completion_handler_type async_completion::completion_handler_type] - -[indexterm2 boost_asio.indexterm.async_completion.completion_handler_type..completion_handler_type..async_completion] -The real handler type to be used for the asynchronous operation. - - - typedef boost::asio::async_result< typename decay< CompletionToken >::type, Signature >::completion_handler_type completion_handler_type; - - -[heading Types] -[table - [[Name][Description]] - - [ - - [[link boost_asio.reference.async_result.completion_handler_type [*completion_handler_type]]] - [The concrete completion handler type for the specific signature. ] - - ] - - [ - - [[link boost_asio.reference.async_result.return_type [*return_type]]] - [The return type of the initiating function. ] - - ] - -] - -[heading Member Functions] -[table - [[Name][Description]] - - [ - [[link boost_asio.reference.async_result.async_result [*async_result]]] - [Construct an async result from a given handler. ] - ] - - [ - [[link boost_asio.reference.async_result.get [*get]]] - [Obtain the value to be returned from the initiating function. ] - ] - -] - -The [link boost_asio.reference.async_result `async_result`] traits class is used for determining: - - -* the concrete completion handler type to be called at the end of the asynchronous operation; - - -* the initiating function return type; and - - -* how the return value of the initiating function is obtained. - -The trait allows the handler and return types to be determined at the point where the specific completion handler signature is known. - -This template may be specialised for user-defined completion token types. The primary template assumes that the CompletionToken is the completion handler. - - -[heading Requirements] - -['Header: ][^boost/asio/async_result.hpp] - -['Convenience header: ][^boost/asio.hpp] - - -[endsect] - - - -[section:result async_completion::result] - -[indexterm2 boost_asio.indexterm.async_completion.result..result..async_completion] -The result of the asynchronous operation's initiating function. - - - async_result< typename decay< CompletionToken >::type, Signature > result; - - - -[endsect] - - - -[endsect] - -[section:async_connect async_connect] - -[indexterm1 boost_asio.indexterm.async_connect..async_connect] -Asynchronously establishes a socket connection by trying each endpoint in a sequence. - - - template< - typename ``[link boost_asio.reference.Protocol Protocol]``, - typename ``[link boost_asio.reference.EndpointSequence EndpointSequence]``, - typename ``[link boost_asio.reference.RangeConnectHandler RangeConnectHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_connect.overload1 async_connect]``( - basic_socket< Protocol > & s, - const EndpointSequence & endpoints, - RangeConnectHandler && handler, - typename enable_if< is_endpoint_sequence< EndpointSequence >::value >::type * = 0); - `` [''''»''' [link boost_asio.reference.async_connect.overload1 more...]]`` - - template< - typename ``[link boost_asio.reference.Protocol Protocol]``, - typename Iterator, - typename ``[link boost_asio.reference.IteratorConnectHandler IteratorConnectHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_connect.overload2 async_connect]``( - basic_socket< Protocol > & s, - Iterator begin, - IteratorConnectHandler && handler, - typename enable_if::value >::type * = 0); - `` [''''»''' [link boost_asio.reference.async_connect.overload2 more...]]`` - - template< - typename ``[link boost_asio.reference.Protocol Protocol]``, - typename Iterator, - typename ``[link boost_asio.reference.IteratorConnectHandler IteratorConnectHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_connect.overload3 async_connect]``( - basic_socket< Protocol > & s, - Iterator begin, - Iterator end, - IteratorConnectHandler && handler); - `` [''''»''' [link boost_asio.reference.async_connect.overload3 more...]]`` - - template< - typename ``[link boost_asio.reference.Protocol Protocol]``, - typename ``[link boost_asio.reference.EndpointSequence EndpointSequence]``, - typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``, - typename ``[link boost_asio.reference.RangeConnectHandler RangeConnectHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_connect.overload4 async_connect]``( - basic_socket< Protocol > & s, - const EndpointSequence & endpoints, - ConnectCondition connect_condition, - RangeConnectHandler && handler, - typename enable_if< is_endpoint_sequence< EndpointSequence >::value >::type * = 0); - `` [''''»''' [link boost_asio.reference.async_connect.overload4 more...]]`` - - template< - typename ``[link boost_asio.reference.Protocol Protocol]``, - typename Iterator, - typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``, - typename ``[link boost_asio.reference.IteratorConnectHandler IteratorConnectHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_connect.overload5 async_connect]``( - basic_socket< Protocol > & s, - Iterator begin, - ConnectCondition connect_condition, - IteratorConnectHandler && handler, - typename enable_if::value >::type * = 0); - `` [''''»''' [link boost_asio.reference.async_connect.overload5 more...]]`` - - template< - typename ``[link boost_asio.reference.Protocol Protocol]``, - typename Iterator, - typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``, - typename ``[link boost_asio.reference.IteratorConnectHandler IteratorConnectHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_connect.overload6 async_connect]``( - basic_socket< Protocol > & s, - Iterator begin, - Iterator end, - ConnectCondition connect_condition, - IteratorConnectHandler && handler); - `` [''''»''' [link boost_asio.reference.async_connect.overload6 more...]]`` - -[heading Requirements] - -['Header: ][^boost/asio/connect.hpp] - -['Convenience header: ][^boost/asio.hpp] - - -[section:overload1 async_connect (1 of 6 overloads)] - - -Asynchronously establishes a socket connection by trying each endpoint in a sequence. - - - template< - typename ``[link boost_asio.reference.Protocol Protocol]``, - typename ``[link boost_asio.reference.EndpointSequence EndpointSequence]``, - typename ``[link boost_asio.reference.RangeConnectHandler RangeConnectHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_connect( - basic_socket< Protocol > & s, - const EndpointSequence & endpoints, - RangeConnectHandler && handler, - typename enable_if< is_endpoint_sequence< EndpointSequence >::value >::type * = 0); - - -This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `async_connect` member function, once for each endpoint in the sequence, until a connection is successfully established. - - -[heading Parameters] - - -[variablelist - -[[s][The socket to be connected. If the socket is already open, it will be closed.]] - -[[endpoints][A sequence of endpoints.]] - -[[handler][The handler to be called when the connect operation completes. Copies will be made of the handler as required. The function signature of the handler must be: -`` - void handler( - // Result of operation. if the sequence is empty, set to - // boost::asio::error::not_found. Otherwise, contains the - // error from the last connection attempt. - const boost::system::error_code& error, - - // On success, the successfully connected endpoint. - // Otherwise, a default-constructed endpoint. - const typename Protocol::endpoint& endpoint - ); -`` -Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_context::post()`.]] - -] - - -[heading Example] - - - - tcp::resolver r(io_context); - tcp::resolver::query q("host", "service"); - tcp::socket s(io_context); - - // ... - - r.async_resolve(q, resolve_handler); - - // ... - - void resolve_handler( - const boost::system::error_code& ec, - tcp::resolver::results_type results) - { - if (!ec) - { - boost::asio::async_connect(s, results, connect_handler); - } - } - - // ... - - void connect_handler( - const boost::system::error_code& ec, - const tcp::endpoint& endpoint) - { - // ... - } - - - - - - - -[endsect] - - - -[section:overload2 async_connect (2 of 6 overloads)] - - -(Deprecated.) Asynchronously establishes a socket connection by trying each endpoint in a sequence. - - - template< - typename ``[link boost_asio.reference.Protocol Protocol]``, - typename Iterator, - typename ``[link boost_asio.reference.IteratorConnectHandler IteratorConnectHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_connect( - basic_socket< Protocol > & s, - Iterator begin, - IteratorConnectHandler && handler, - typename enable_if::value >::type * = 0); - - -This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `async_connect` member function, once for each endpoint in the sequence, until a connection is successfully established. - - -[heading Parameters] - - -[variablelist - -[[s][The socket to be connected. If the socket is already open, it will be closed.]] - -[[begin][An iterator pointing to the start of a sequence of endpoints.]] - -[[handler][The handler to be called when the connect operation completes. Copies will be made of the handler as required. The function signature of the handler must be: -`` - void handler( - // Result of operation. if the sequence is empty, set to - // boost::asio::error::not_found. Otherwise, contains the - // error from the last connection attempt. - const boost::system::error_code& error, - - // On success, an iterator denoting the successfully - // connected endpoint. Otherwise, the end iterator. - Iterator iterator - ); -`` -Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_context::post()`.]] - -] - - -[heading Remarks] - -This overload assumes that a default constructed object of type `Iterator` represents the end of the sequence. This is a valid assumption for iterator types such as `boost::asio::ip::tcp::resolver::iterator`. - - - - -[endsect] - - - -[section:overload3 async_connect (3 of 6 overloads)] - - -Asynchronously establishes a socket connection by trying each endpoint in a sequence. - - - template< - typename ``[link boost_asio.reference.Protocol Protocol]``, - typename Iterator, - typename ``[link boost_asio.reference.IteratorConnectHandler IteratorConnectHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_connect( - basic_socket< Protocol > & s, - Iterator begin, - Iterator end, - IteratorConnectHandler && handler); - - -This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `async_connect` member function, once for each endpoint in the sequence, until a connection is successfully established. - - -[heading Parameters] - - -[variablelist - -[[s][The socket to be connected. If the socket is already open, it will be closed.]] - -[[begin][An iterator pointing to the start of a sequence of endpoints.]] - -[[end][An iterator pointing to the end of a sequence of endpoints.]] - -[[handler][The handler to be called when the connect operation completes. Copies will be made of the handler as required. The function signature of the handler must be: -`` - void handler( - // Result of operation. if the sequence is empty, set to - // boost::asio::error::not_found. Otherwise, contains the - // error from the last connection attempt. - const boost::system::error_code& error, - - // On success, an iterator denoting the successfully - // connected endpoint. Otherwise, the end iterator. - Iterator iterator - ); -`` -Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_context::post()`.]] - -] - - -[heading Example] - - - - std::vector endpoints = ...; - tcp::socket s(io_context); - boost::asio::async_connect(s, - endpoints.begin(), endpoints.end(), - connect_handler); - - // ... - - void connect_handler( - const boost::system::error_code& ec, - std::vector::iterator i) - { - // ... - } - - - - - - - -[endsect] - - - -[section:overload4 async_connect (4 of 6 overloads)] - - -Asynchronously establishes a socket connection by trying each endpoint in a sequence. - - - template< - typename ``[link boost_asio.reference.Protocol Protocol]``, - typename ``[link boost_asio.reference.EndpointSequence EndpointSequence]``, - typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``, - typename ``[link boost_asio.reference.RangeConnectHandler RangeConnectHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_connect( - basic_socket< Protocol > & s, - const EndpointSequence & endpoints, - ConnectCondition connect_condition, - RangeConnectHandler && handler, - typename enable_if< is_endpoint_sequence< EndpointSequence >::value >::type * = 0); - - -This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `async_connect` member function, once for each endpoint in the sequence, until a connection is successfully established. - - -[heading Parameters] - - -[variablelist - -[[s][The socket to be connected. If the socket is already open, it will be closed.]] - -[[endpoints][A sequence of endpoints.]] - -[[connect_condition][A function object that is called prior to each connection attempt. The signature of the function object must be: -`` - bool connect_condition( - const boost::system::error_code& ec, - const typename Protocol::endpoint& next); -`` -The `ec` parameter contains the result from the most recent connect operation. Before the first connection attempt, `ec` is always set to indicate success. The `next` parameter is the next endpoint to be tried. The function object should return true if the next endpoint should be tried, and false if it should be skipped.]] - -[[handler][The handler to be called when the connect operation completes. Copies will be made of the handler as required. The function signature of the handler must be: -`` - void handler( - // Result of operation. if the sequence is empty, set to - // boost::asio::error::not_found. Otherwise, contains the - // error from the last connection attempt. - const boost::system::error_code& error, - - // On success, an iterator denoting the successfully - // connected endpoint. Otherwise, the end iterator. - Iterator iterator - ); -`` -Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_context::post()`.]] - -] - - -[heading Example] - -The following connect condition function object can be used to output information about the individual connection attempts: - - struct my_connect_condition - { - bool operator()( - const boost::system::error_code& ec, - const::tcp::endpoint& next) - { - if (ec) std::cout << "Error: " << ec.message() << std::endl; - std::cout << "Trying: " << next << std::endl; - return true; - } - }; - - -It would be used with the `boost::asio::connect` function as follows: - - tcp::resolver r(io_context); - tcp::resolver::query q("host", "service"); - tcp::socket s(io_context); - - // ... - - r.async_resolve(q, resolve_handler); - - // ... - - void resolve_handler( - const boost::system::error_code& ec, - tcp::resolver::results_type results) - { - if (!ec) - { - boost::asio::async_connect(s, results, - my_connect_condition(), - connect_handler); - } - } - - // ... - - void connect_handler( - const boost::system::error_code& ec, - const tcp::endpoint& endpoint) - { - if (ec) - { - // An error occurred. - } - else - { - std::cout << "Connected to: " << endpoint << std::endl; - } - } - - - - - - - -[endsect] - - - -[section:overload5 async_connect (5 of 6 overloads)] - - -(Deprecated.) Asynchronously establishes a socket connection by trying each endpoint in a sequence. - - - template< - typename ``[link boost_asio.reference.Protocol Protocol]``, - typename Iterator, - typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``, - typename ``[link boost_asio.reference.IteratorConnectHandler IteratorConnectHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_connect( - basic_socket< Protocol > & s, - Iterator begin, - ConnectCondition connect_condition, - IteratorConnectHandler && handler, - typename enable_if::value >::type * = 0); - - -This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `async_connect` member function, once for each endpoint in the sequence, until a connection is successfully established. - - -[heading Parameters] - - -[variablelist - -[[s][The socket to be connected. If the socket is already open, it will be closed.]] - -[[begin][An iterator pointing to the start of a sequence of endpoints.]] - -[[connect_condition][A function object that is called prior to each connection attempt. The signature of the function object must be: -`` - bool connect_condition( - const boost::system::error_code& ec, - const typename Protocol::endpoint& next); -`` -The `ec` parameter contains the result from the most recent connect operation. Before the first connection attempt, `ec` is always set to indicate success. The `next` parameter is the next endpoint to be tried. The function object should return true if the next endpoint should be tried, and false if it should be skipped.]] - -[[handler][The handler to be called when the connect operation completes. Copies will be made of the handler as required. The function signature of the handler must be: -`` - void handler( - // Result of operation. if the sequence is empty, set to - // boost::asio::error::not_found. Otherwise, contains the - // error from the last connection attempt. - const boost::system::error_code& error, - - // On success, an iterator denoting the successfully - // connected endpoint. Otherwise, the end iterator. - Iterator iterator - ); -`` -Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_context::post()`.]] - -] - - -[heading Remarks] - -This overload assumes that a default constructed object of type `Iterator` represents the end of the sequence. This is a valid assumption for iterator types such as `boost::asio::ip::tcp::resolver::iterator`. - - - - -[endsect] - - - -[section:overload6 async_connect (6 of 6 overloads)] - - -Asynchronously establishes a socket connection by trying each endpoint in a sequence. - - - template< - typename ``[link boost_asio.reference.Protocol Protocol]``, - typename Iterator, - typename ``[link boost_asio.reference.ConnectCondition ConnectCondition]``, - typename ``[link boost_asio.reference.IteratorConnectHandler IteratorConnectHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_connect( - basic_socket< Protocol > & s, - Iterator begin, - Iterator end, - ConnectCondition connect_condition, - IteratorConnectHandler && handler); - - -This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `async_connect` member function, once for each endpoint in the sequence, until a connection is successfully established. - - -[heading Parameters] - - -[variablelist - -[[s][The socket to be connected. If the socket is already open, it will be closed.]] - -[[begin][An iterator pointing to the start of a sequence of endpoints.]] - -[[end][An iterator pointing to the end of a sequence of endpoints.]] - -[[connect_condition][A function object that is called prior to each connection attempt. The signature of the function object must be: -`` - bool connect_condition( - const boost::system::error_code& ec, - const typename Protocol::endpoint& next); -`` -The `ec` parameter contains the result from the most recent connect operation. Before the first connection attempt, `ec` is always set to indicate success. The `next` parameter is the next endpoint to be tried. The function object should return true if the next endpoint should be tried, and false if it should be skipped.]] - -[[handler][The handler to be called when the connect operation completes. Copies will be made of the handler as required. The function signature of the handler must be: -`` - void handler( - // Result of operation. if the sequence is empty, set to - // boost::asio::error::not_found. Otherwise, contains the - // error from the last connection attempt. - const boost::system::error_code& error, - - // On success, an iterator denoting the successfully - // connected endpoint. Otherwise, the end iterator. - Iterator iterator - ); -`` -Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_context::post()`.]] - -] - - -[heading Example] - -The following connect condition function object can be used to output information about the individual connection attempts: - - struct my_connect_condition - { - bool operator()( - const boost::system::error_code& ec, - const::tcp::endpoint& next) - { - if (ec) std::cout << "Error: " << ec.message() << std::endl; - std::cout << "Trying: " << next << std::endl; - return true; - } - }; - - -It would be used with the `boost::asio::connect` function as follows: - - tcp::resolver r(io_context); - tcp::resolver::query q("host", "service"); - tcp::socket s(io_context); - - // ... - - r.async_resolve(q, resolve_handler); - - // ... - - void resolve_handler( - const boost::system::error_code& ec, - tcp::resolver::iterator i) - { - if (!ec) - { - tcp::resolver::iterator end; - boost::asio::async_connect(s, i, end, - my_connect_condition(), - connect_handler); - } - } - - // ... - - void connect_handler( - const boost::system::error_code& ec, - tcp::resolver::iterator i) - { - if (ec) - { - // An error occurred. - } - else - { - std::cout << "Connected to: " << i->endpoint() << std::endl; - } - } - - - - - - - -[endsect] - - -[endsect] - -[section:async_read async_read] - -[indexterm1 boost_asio.indexterm.async_read..async_read] -Start an asynchronous operation to read a certain amount of data from a stream. - - - template< - typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, - typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, - typename ``[link boost_asio.reference.ReadHandler ReadHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read.overload1 async_read]``( - AsyncReadStream & s, - const MutableBufferSequence & buffers, - ReadHandler && handler, - typename enable_if< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type * = 0); - `` [''''»''' [link boost_asio.reference.async_read.overload1 more...]]`` - - template< - typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, - typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, - typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``, - typename ``[link boost_asio.reference.ReadHandler ReadHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read.overload2 async_read]``( - AsyncReadStream & s, - const MutableBufferSequence & buffers, - CompletionCondition completion_condition, - ReadHandler && handler, - typename enable_if< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type * = 0); - `` [''''»''' [link boost_asio.reference.async_read.overload2 more...]]`` - - template< - typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, - typename ``[link boost_asio.reference.DynamicBuffer DynamicBuffer]``, - typename ``[link boost_asio.reference.ReadHandler ReadHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read.overload3 async_read]``( - AsyncReadStream & s, - DynamicBuffer && buffers, - ReadHandler && handler, - typename enable_if< is_dynamic_buffer< typename decay< DynamicBuffer >::type >::value >::type * = 0); - `` [''''»''' [link boost_asio.reference.async_read.overload3 more...]]`` - - template< - typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, - typename ``[link boost_asio.reference.DynamicBuffer DynamicBuffer]``, - typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``, - typename ``[link boost_asio.reference.ReadHandler ReadHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read.overload4 async_read]``( - AsyncReadStream & s, - DynamicBuffer && buffers, - CompletionCondition completion_condition, - ReadHandler && handler, - typename enable_if< is_dynamic_buffer< typename decay< DynamicBuffer >::type >::value >::type * = 0); - `` [''''»''' [link boost_asio.reference.async_read.overload4 more...]]`` - - template< - typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, - typename Allocator, - typename ``[link boost_asio.reference.ReadHandler ReadHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read.overload5 async_read]``( - AsyncReadStream & s, - basic_streambuf< Allocator > & b, - ReadHandler && handler); - `` [''''»''' [link boost_asio.reference.async_read.overload5 more...]]`` - - template< - typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, - typename Allocator, - typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``, - typename ``[link boost_asio.reference.ReadHandler ReadHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read.overload6 async_read]``( - AsyncReadStream & s, - basic_streambuf< Allocator > & b, - CompletionCondition completion_condition, - ReadHandler && handler); - `` [''''»''' [link boost_asio.reference.async_read.overload6 more...]]`` - -[heading Requirements] - -['Header: ][^boost/asio/read.hpp] - -['Convenience header: ][^boost/asio.hpp] - - -[section:overload1 async_read (1 of 6 overloads)] - - -Start an asynchronous operation to read a certain amount of data from a stream. - - - template< - typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, - typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, - typename ``[link boost_asio.reference.ReadHandler ReadHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read( - AsyncReadStream & s, - const MutableBufferSequence & buffers, - ReadHandler && handler, - typename enable_if< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type * = 0); - - -This function is used to asynchronously read a certain number of bytes of data from a stream. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true: - - -* The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes. - - -* An error occurred. - -This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. The program must ensure that the stream performs no other read operations (such as async\_read, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes. - - -[heading Parameters] - - -[variablelist - -[[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]] - -[[buffers][One or more buffers into which the data will be read. The sum of the buffer sizes indicates the maximum number of bytes to read from the stream. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]] - -[[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: -`` - void handler( - const boost::system::error_code& error, // Result of operation. - - std::size_t bytes_transferred // Number of bytes copied into the - // buffers. If an error occurred, - // this will be the number of - // bytes successfully transferred - // prior to the error. - ); -`` -Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_context::post()`.]] - -] - - -[heading Example] - -To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: - - boost::asio::async_read(s, boost::asio::buffer(data, size), handler); - - -See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. - - -[heading Remarks] - -This overload is equivalent to calling: - - boost::asio::async_read( - s, buffers, - boost::asio::transfer_all(), - handler); - - - - - - - -[endsect] - - - -[section:overload2 async_read (2 of 6 overloads)] - - -Start an asynchronous operation to read a certain amount of data from a stream. - - - template< - typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, - typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, - typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``, - typename ``[link boost_asio.reference.ReadHandler ReadHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read( - AsyncReadStream & s, - const MutableBufferSequence & buffers, - CompletionCondition completion_condition, - ReadHandler && handler, - typename enable_if< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type * = 0); - - -This function is used to asynchronously read a certain number of bytes of data from a stream. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true: - - -* The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes. - - -* The completion\_condition function object returns 0. - - -[heading Parameters] - - -[variablelist - -[[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]] - -[[buffers][One or more buffers into which the data will be read. The sum of the buffer sizes indicates the maximum number of bytes to read from the stream. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]] - -[[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be: -`` - std::size_t completion_condition( - // Result of latest async_read_some operation. - const boost::system::error_code& error, - - // Number of bytes transferred so far. - std::size_t bytes_transferred - ); -`` -A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the stream's async\_read\_some function.]] - -[[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: -`` - void handler( - const boost::system::error_code& error, // Result of operation. - - std::size_t bytes_transferred // Number of bytes copied into the - // buffers. If an error occurred, - // this will be the number of - // bytes successfully transferred - // prior to the error. - ); -`` -Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_context::post()`.]] - -] - - -[heading Example] - -To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: - - boost::asio::async_read(s, - boost::asio::buffer(data, size), - boost::asio::transfer_at_least(32), - handler); - - -See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. - - - - -[endsect] - - - -[section:overload3 async_read (3 of 6 overloads)] - - -Start an asynchronous operation to read a certain amount of data from a stream. - - - template< - typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, - typename ``[link boost_asio.reference.DynamicBuffer DynamicBuffer]``, - typename ``[link boost_asio.reference.ReadHandler ReadHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read( - AsyncReadStream & s, - DynamicBuffer && buffers, - ReadHandler && handler, - typename enable_if< is_dynamic_buffer< typename decay< DynamicBuffer >::type >::value >::type * = 0); - - -This function is used to asynchronously read a certain number of bytes of data from a stream. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true: - - -* The specified dynamic buffer sequence is full (that is, it has reached maximum size). - - -* An error occurred. - -This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. The program must ensure that the stream performs no other read operations (such as async\_read, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes. - - -[heading Parameters] - - -[variablelist - -[[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]] - -[[buffers][The dynamic buffer sequence into which the data will be read. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]] - -[[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: -`` - void handler( - const boost::system::error_code& error, // Result of operation. - - std::size_t bytes_transferred // Number of bytes copied into the - // buffers. If an error occurred, - // this will be the number of - // bytes successfully transferred - // prior to the error. - ); -`` -Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_context::post()`.]] - -] - - -[heading Remarks] - -This overload is equivalent to calling: - - boost::asio::async_read( - s, buffers, - boost::asio::transfer_all(), - handler); - - - - - - - -[endsect] - - - -[section:overload4 async_read (4 of 6 overloads)] - - -Start an asynchronous operation to read a certain amount of data from a stream. - - - template< - typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, - typename ``[link boost_asio.reference.DynamicBuffer DynamicBuffer]``, - typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``, - typename ``[link boost_asio.reference.ReadHandler ReadHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read( - AsyncReadStream & s, - DynamicBuffer && buffers, - CompletionCondition completion_condition, - ReadHandler && handler, - typename enable_if< is_dynamic_buffer< typename decay< DynamicBuffer >::type >::value >::type * = 0); - - -This function is used to asynchronously read a certain number of bytes of data from a stream. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true: - - -* The specified dynamic buffer sequence is full (that is, it has reached maximum size). - - -* The completion\_condition function object returns 0. - -This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. The program must ensure that the stream performs no other read operations (such as async\_read, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes. - - -[heading Parameters] - - -[variablelist - -[[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]] - -[[buffers][The dynamic buffer sequence into which the data will be read. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]] - -[[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be: -`` - std::size_t completion_condition( - // Result of latest async_read_some operation. - const boost::system::error_code& error, - - // Number of bytes transferred so far. - std::size_t bytes_transferred - ); -`` -A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the stream's async\_read\_some function.]] - -[[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: -`` - void handler( - const boost::system::error_code& error, // Result of operation. - - std::size_t bytes_transferred // Number of bytes copied into the - // buffers. If an error occurred, - // this will be the number of - // bytes successfully transferred - // prior to the error. - ); -`` -Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_context::post()`. ]] - -] - - - - -[endsect] - - - -[section:overload5 async_read (5 of 6 overloads)] - - -Start an asynchronous operation to read a certain amount of data from a stream. - - - template< - typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, - typename Allocator, - typename ``[link boost_asio.reference.ReadHandler ReadHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read( - AsyncReadStream & s, - basic_streambuf< Allocator > & b, - ReadHandler && handler); - - -This function is used to asynchronously read a certain number of bytes of data from a stream. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true: - - -* The supplied buffer is full (that is, it has reached maximum size). - - -* An error occurred. - -This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. The program must ensure that the stream performs no other read operations (such as async\_read, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes. - - -[heading Parameters] - - -[variablelist - -[[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]] - -[[b][A [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read. Ownership of the streambuf is retained by the caller, which must guarantee that it remains valid until the handler is called.]] - -[[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: -`` - void handler( - const boost::system::error_code& error, // Result of operation. - - std::size_t bytes_transferred // Number of bytes copied into the - // buffers. If an error occurred, - // this will be the number of - // bytes successfully transferred - // prior to the error. - ); -`` -Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_context::post()`.]] - -] - - -[heading Remarks] - -This overload is equivalent to calling: - - boost::asio::async_read( - s, b, - boost::asio::transfer_all(), - handler); - - - - - - - -[endsect] - - - -[section:overload6 async_read (6 of 6 overloads)] - - -Start an asynchronous operation to read a certain amount of data from a stream. - - - template< - typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, - typename Allocator, - typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``, - typename ``[link boost_asio.reference.ReadHandler ReadHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read( - AsyncReadStream & s, - basic_streambuf< Allocator > & b, - CompletionCondition completion_condition, - ReadHandler && handler); - - -This function is used to asynchronously read a certain number of bytes of data from a stream. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true: - - -* The supplied buffer is full (that is, it has reached maximum size). - - -* The completion\_condition function object returns 0. - -This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. The program must ensure that the stream performs no other read operations (such as async\_read, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes. - - -[heading Parameters] - - -[variablelist - -[[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]] - -[[b][A [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read. Ownership of the streambuf is retained by the caller, which must guarantee that it remains valid until the handler is called.]] - -[[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be: -`` - std::size_t completion_condition( - // Result of latest async_read_some operation. - const boost::system::error_code& error, - - // Number of bytes transferred so far. - std::size_t bytes_transferred - ); -`` -A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the stream's async\_read\_some function.]] - -[[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: -`` - void handler( - const boost::system::error_code& error, // Result of operation. - - std::size_t bytes_transferred // Number of bytes copied into the - // buffers. If an error occurred, - // this will be the number of - // bytes successfully transferred - // prior to the error. - ); -`` -Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_context::post()`. ]] - -] - - - - -[endsect] - - -[endsect] - -[section:async_read_at async_read_at] - -[indexterm1 boost_asio.indexterm.async_read_at..async_read_at] -Start an asynchronous operation to read a certain amount of data at the specified offset. - - - template< - typename ``[link boost_asio.reference.AsyncRandomAccessReadDevice AsyncRandomAccessReadDevice]``, - typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, - typename ``[link boost_asio.reference.ReadHandler ReadHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read_at.overload1 async_read_at]``( - AsyncRandomAccessReadDevice & d, - uint64_t offset, - const MutableBufferSequence & buffers, - ReadHandler && handler); - `` [''''»''' [link boost_asio.reference.async_read_at.overload1 more...]]`` - - template< - typename ``[link boost_asio.reference.AsyncRandomAccessReadDevice AsyncRandomAccessReadDevice]``, - typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, - typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``, - typename ``[link boost_asio.reference.ReadHandler ReadHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read_at.overload2 async_read_at]``( - AsyncRandomAccessReadDevice & d, - uint64_t offset, - const MutableBufferSequence & buffers, - CompletionCondition completion_condition, - ReadHandler && handler); - `` [''''»''' [link boost_asio.reference.async_read_at.overload2 more...]]`` - - template< - typename ``[link boost_asio.reference.AsyncRandomAccessReadDevice AsyncRandomAccessReadDevice]``, - typename Allocator, - typename ``[link boost_asio.reference.ReadHandler ReadHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read_at.overload3 async_read_at]``( - AsyncRandomAccessReadDevice & d, - uint64_t offset, - basic_streambuf< Allocator > & b, - ReadHandler && handler); - `` [''''»''' [link boost_asio.reference.async_read_at.overload3 more...]]`` - - template< - typename ``[link boost_asio.reference.AsyncRandomAccessReadDevice AsyncRandomAccessReadDevice]``, - typename Allocator, - typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``, - typename ``[link boost_asio.reference.ReadHandler ReadHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read_at.overload4 async_read_at]``( - AsyncRandomAccessReadDevice & d, - uint64_t offset, - basic_streambuf< Allocator > & b, - CompletionCondition completion_condition, - ReadHandler && handler); - `` [''''»''' [link boost_asio.reference.async_read_at.overload4 more...]]`` - -[heading Requirements] - -['Header: ][^boost/asio/read_at.hpp] - -['Convenience header: ][^boost/asio.hpp] - - -[section:overload1 async_read_at (1 of 4 overloads)] - - -Start an asynchronous operation to read a certain amount of data at the specified offset. - - - template< - typename ``[link boost_asio.reference.AsyncRandomAccessReadDevice AsyncRandomAccessReadDevice]``, - typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, - typename ``[link boost_asio.reference.ReadHandler ReadHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_at( - AsyncRandomAccessReadDevice & d, - uint64_t offset, - const MutableBufferSequence & buffers, - ReadHandler && handler); - - -This function is used to asynchronously read a certain number of bytes of data from a random access device at the specified offset. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true: - - -* The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes. - - -* An error occurred. - -This operation is implemented in terms of zero or more calls to the device's async\_read\_some\_at function. - - -[heading Parameters] - - -[variablelist - -[[d][The device from which the data is to be read. The type must support the AsyncRandomAccessReadDevice concept.]] - -[[offset][The offset at which the data will be read.]] - -[[buffers][One or more buffers into which the data will be read. The sum of the buffer sizes indicates the maximum number of bytes to read from the device. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]] - -[[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: -`` - void handler( - // Result of operation. - const boost::system::error_code& error, - - // Number of bytes copied into the buffers. If an error - // occurred, this will be the number of bytes successfully - // transferred prior to the error. - std::size_t bytes_transferred - ); -`` -Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_context::post()`.]] - -] - - -[heading Example] - -To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: - - boost::asio::async_read_at(d, 42, boost::asio::buffer(data, size), handler); - - -See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. - - -[heading Remarks] - -This overload is equivalent to calling: - - boost::asio::async_read_at( - d, 42, buffers, - boost::asio::transfer_all(), - handler); - - - - - - - -[endsect] - - - -[section:overload2 async_read_at (2 of 4 overloads)] - - -Start an asynchronous operation to read a certain amount of data at the specified offset. - - - template< - typename ``[link boost_asio.reference.AsyncRandomAccessReadDevice AsyncRandomAccessReadDevice]``, - typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, - typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``, - typename ``[link boost_asio.reference.ReadHandler ReadHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_at( - AsyncRandomAccessReadDevice & d, - uint64_t offset, - const MutableBufferSequence & buffers, - CompletionCondition completion_condition, - ReadHandler && handler); - - -This function is used to asynchronously read a certain number of bytes of data from a random access device at the specified offset. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true: - - -* The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes. - - -* The completion\_condition function object returns 0. - - -[heading Parameters] - - -[variablelist - -[[d][The device from which the data is to be read. The type must support the AsyncRandomAccessReadDevice concept.]] - -[[offset][The offset at which the data will be read.]] - -[[buffers][One or more buffers into which the data will be read. The sum of the buffer sizes indicates the maximum number of bytes to read from the device. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]] - -[[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be: -`` - std::size_t completion_condition( - // Result of latest async_read_some_at operation. - const boost::system::error_code& error, - - // Number of bytes transferred so far. - std::size_t bytes_transferred - ); -`` -A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the device's async\_read\_some\_at function.]] - -[[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: -`` - void handler( - // Result of operation. - const boost::system::error_code& error, - - // Number of bytes copied into the buffers. If an error - // occurred, this will be the number of bytes successfully - // transferred prior to the error. - std::size_t bytes_transferred - ); -`` -Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_context::post()`.]] - -] - - -[heading Example] - -To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: - - boost::asio::async_read_at(d, 42, - boost::asio::buffer(data, size), - boost::asio::transfer_at_least(32), - handler); - - -See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. - - - - -[endsect] - - - -[section:overload3 async_read_at (3 of 4 overloads)] - - -Start an asynchronous operation to read a certain amount of data at the specified offset. - - - template< - typename ``[link boost_asio.reference.AsyncRandomAccessReadDevice AsyncRandomAccessReadDevice]``, - typename Allocator, - typename ``[link boost_asio.reference.ReadHandler ReadHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_at( - AsyncRandomAccessReadDevice & d, - uint64_t offset, - basic_streambuf< Allocator > & b, - ReadHandler && handler); - - -This function is used to asynchronously read a certain number of bytes of data from a random access device at the specified offset. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true: - - -* An error occurred. - -This operation is implemented in terms of zero or more calls to the device's async\_read\_some\_at function. - - -[heading Parameters] - - -[variablelist - -[[d][The device from which the data is to be read. The type must support the AsyncRandomAccessReadDevice concept.]] - -[[offset][The offset at which the data will be read.]] - -[[b][A [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read. Ownership of the streambuf is retained by the caller, which must guarantee that it remains valid until the handler is called.]] - -[[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: -`` - void handler( - // Result of operation. - const boost::system::error_code& error, - - // Number of bytes copied into the buffers. If an error - // occurred, this will be the number of bytes successfully - // transferred prior to the error. - std::size_t bytes_transferred - ); -`` -Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_context::post()`.]] - -] - - -[heading Remarks] - -This overload is equivalent to calling: - - boost::asio::async_read_at( - d, 42, b, - boost::asio::transfer_all(), - handler); - - - - - - - -[endsect] - - - -[section:overload4 async_read_at (4 of 4 overloads)] - - -Start an asynchronous operation to read a certain amount of data at the specified offset. - - - template< - typename ``[link boost_asio.reference.AsyncRandomAccessReadDevice AsyncRandomAccessReadDevice]``, - typename Allocator, - typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``, - typename ``[link boost_asio.reference.ReadHandler ReadHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_at( - AsyncRandomAccessReadDevice & d, - uint64_t offset, - basic_streambuf< Allocator > & b, - CompletionCondition completion_condition, - ReadHandler && handler); - - -This function is used to asynchronously read a certain number of bytes of data from a random access device at the specified offset. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true: - - -* The completion\_condition function object returns 0. - -This operation is implemented in terms of zero or more calls to the device's async\_read\_some\_at function. - - -[heading Parameters] - - -[variablelist - -[[d][The device from which the data is to be read. The type must support the AsyncRandomAccessReadDevice concept.]] - -[[offset][The offset at which the data will be read.]] - -[[b][A [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read. Ownership of the streambuf is retained by the caller, which must guarantee that it remains valid until the handler is called.]] - -[[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be: -`` - std::size_t completion_condition( - // Result of latest async_read_some_at operation. - const boost::system::error_code& error, - - // Number of bytes transferred so far. - std::size_t bytes_transferred - ); -`` -A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the device's async\_read\_some\_at function.]] - -[[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: -`` - void handler( - // Result of operation. - const boost::system::error_code& error, - - // Number of bytes copied into the buffers. If an error - // occurred, this will be the number of bytes successfully - // transferred prior to the error. - std::size_t bytes_transferred - ); -`` -Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_context::post()`. ]] - -] - - - - -[endsect] - - -[endsect] - -[section:async_read_until async_read_until] - -[indexterm1 boost_asio.indexterm.async_read_until..async_read_until] -Start an asynchronous operation to read data into a dynamic buffer sequence, or into a streambuf, until it contains a delimiter, matches a regular expression, or a function object indicates a match. - - - template< - typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, - typename ``[link boost_asio.reference.DynamicBuffer DynamicBuffer]``, - typename ``[link boost_asio.reference.ReadHandler ReadHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read_until.overload1 async_read_until]``( - AsyncReadStream & s, - DynamicBuffer && buffers, - char delim, - ReadHandler && handler); - `` [''''»''' [link boost_asio.reference.async_read_until.overload1 more...]]`` - - template< - typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, - typename ``[link boost_asio.reference.DynamicBuffer DynamicBuffer]``, - typename ``[link boost_asio.reference.ReadHandler ReadHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read_until.overload2 async_read_until]``( - AsyncReadStream & s, - DynamicBuffer && buffers, - string_view delim, - ReadHandler && handler); - `` [''''»''' [link boost_asio.reference.async_read_until.overload2 more...]]`` - - template< - typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, - typename ``[link boost_asio.reference.DynamicBuffer DynamicBuffer]``, - typename ``[link boost_asio.reference.ReadHandler ReadHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read_until.overload3 async_read_until]``( - AsyncReadStream & s, - DynamicBuffer && buffers, - const boost::regex & expr, - ReadHandler && handler); - `` [''''»''' [link boost_asio.reference.async_read_until.overload3 more...]]`` - - template< - typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, - typename ``[link boost_asio.reference.DynamicBuffer DynamicBuffer]``, - typename MatchCondition, - typename ``[link boost_asio.reference.ReadHandler ReadHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read_until.overload4 async_read_until]``( - AsyncReadStream & s, - DynamicBuffer && buffers, - MatchCondition match_condition, - ReadHandler && handler, - typename enable_if< is_match_condition< MatchCondition >::value >::type * = 0); - `` [''''»''' [link boost_asio.reference.async_read_until.overload4 more...]]`` - - template< - typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, - typename Allocator, - typename ``[link boost_asio.reference.ReadHandler ReadHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read_until.overload5 async_read_until]``( - AsyncReadStream & s, - boost::asio::basic_streambuf< Allocator > & b, - char delim, - ReadHandler && handler); - `` [''''»''' [link boost_asio.reference.async_read_until.overload5 more...]]`` - - template< - typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, - typename Allocator, - typename ``[link boost_asio.reference.ReadHandler ReadHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read_until.overload6 async_read_until]``( - AsyncReadStream & s, - boost::asio::basic_streambuf< Allocator > & b, - string_view delim, - ReadHandler && handler); - `` [''''»''' [link boost_asio.reference.async_read_until.overload6 more...]]`` - - template< - typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, - typename Allocator, - typename ``[link boost_asio.reference.ReadHandler ReadHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read_until.overload7 async_read_until]``( - AsyncReadStream & s, - boost::asio::basic_streambuf< Allocator > & b, - const boost::regex & expr, - ReadHandler && handler); - `` [''''»''' [link boost_asio.reference.async_read_until.overload7 more...]]`` - - template< - typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, - typename Allocator, - typename MatchCondition, - typename ``[link boost_asio.reference.ReadHandler ReadHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_read_until.overload8 async_read_until]``( - AsyncReadStream & s, - boost::asio::basic_streambuf< Allocator > & b, - MatchCondition match_condition, - ReadHandler && handler, - typename enable_if< is_match_condition< MatchCondition >::value >::type * = 0); - `` [''''»''' [link boost_asio.reference.async_read_until.overload8 more...]]`` - -[heading Requirements] - -['Header: ][^boost/asio/read_until.hpp] - -['Convenience header: ][^boost/asio.hpp] - - -[section:overload1 async_read_until (1 of 8 overloads)] - - -Start an asynchronous operation to read data into a dynamic buffer sequence until it contains a specified delimiter. - - - template< - typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, - typename ``[link boost_asio.reference.DynamicBuffer DynamicBuffer]``, - typename ``[link boost_asio.reference.ReadHandler ReadHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_until( - AsyncReadStream & s, - DynamicBuffer && buffers, - char delim, - ReadHandler && handler); - - -This function is used to asynchronously read data into the specified dynamic buffer sequence until the dynamic buffer sequence's get area contains the specified delimiter. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true: - - -* The get area of the dynamic buffer sequence contains the specified delimiter. - - -* An error occurred. - -This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. If the dynamic buffer sequence's get area already contains the delimiter, this asynchronous operation completes immediately. The program must ensure that the stream performs no other read operations (such as async\_read, async\_read\_until, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes. - - -[heading Parameters] - - -[variablelist - -[[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]] - -[[buffers][The dynamic buffer sequence into which the data will be read. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]] - -[[delim][The delimiter character.]] - -[[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: -`` - void handler( - // Result of operation. - const boost::system::error_code& error, - - // The number of bytes in the dynamic buffer sequence's - // get area up to and including the delimiter. - // 0 if an error occurred. - std::size_t bytes_transferred - ); -`` -Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_context::post()`.]] - -] - - -[heading Remarks] - -After a successful async\_read\_until operation, the dynamic buffer sequence may contain additional data beyond the delimiter. An application will typically leave that data in the dynamic buffer sequence for a subsequent async\_read\_until operation to examine. - - -[heading Example] - -To asynchronously read data into a `std::string` until a newline is encountered: - - std::string data; - ... - void handler(const boost::system::error_code& e, std::size_t size) - { - if (!e) - { - std::string line = data.substr(0, n); - data.erase(0, n); - ... - } - } - ... - boost::asio::async_read_until(s, data, '\n', handler); - - -After the `async_read_until` operation completes successfully, the buffer `data` contains the delimiter: - - { 'a', 'b', ..., 'c', '\n', 'd', 'e', ... } - - -The call to `substr` then extracts the data up to and including the delimiter, so that the string `line` contains: - - { 'a', 'b', ..., 'c', '\n' } - - -After the call to `erase`, the remaining data is left in the buffer `data` as follows: - - { 'd', 'e', ... } - - -This data may be the start of a new line, to be extracted by a subsequent `async_read_until` operation. - - - - -[endsect] - - - -[section:overload2 async_read_until (2 of 8 overloads)] - - -Start an asynchronous operation to read data into a dynamic buffer sequence until it contains a specified delimiter. - - - template< - typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, - typename ``[link boost_asio.reference.DynamicBuffer DynamicBuffer]``, - typename ``[link boost_asio.reference.ReadHandler ReadHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_until( - AsyncReadStream & s, - DynamicBuffer && buffers, - string_view delim, - ReadHandler && handler); - - -This function is used to asynchronously read data into the specified dynamic buffer sequence until the dynamic buffer sequence's get area contains the specified delimiter. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true: - - -* The get area of the dynamic buffer sequence contains the specified delimiter. - - -* An error occurred. - -This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. If the dynamic buffer sequence's get area already contains the delimiter, this asynchronous operation completes immediately. The program must ensure that the stream performs no other read operations (such as async\_read, async\_read\_until, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes. - - -[heading Parameters] - - -[variablelist - -[[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]] - -[[buffers][The dynamic buffer sequence into which the data will be read. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]] - -[[delim][The delimiter string.]] - -[[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: -`` - void handler( - // Result of operation. - const boost::system::error_code& error, - - // The number of bytes in the dynamic buffer sequence's - // get area up to and including the delimiter. - // 0 if an error occurred. - std::size_t bytes_transferred - ); -`` -Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_context::post()`.]] - -] - - -[heading Remarks] - -After a successful async\_read\_until operation, the dynamic buffer sequence may contain additional data beyond the delimiter. An application will typically leave that data in the dynamic buffer sequence for a subsequent async\_read\_until operation to examine. - - -[heading Example] - -To asynchronously read data into a `std::string` until a CR-LF sequence is encountered: - - std::string data; - ... - void handler(const boost::system::error_code& e, std::size_t size) - { - if (!e) - { - std::string line = data.substr(0, n); - data.erase(0, n); - ... - } - } - ... - boost::asio::async_read_until(s, data, "\r\n", handler); - - -After the `async_read_until` operation completes successfully, the string `data` contains the delimiter: - - { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... } - - -The call to `substr` then extracts the data up to and including the delimiter, so that the string `line` contains: - - { 'a', 'b', ..., 'c', '\r', '\n' } - - -After the call to `erase`, the remaining data is left in the string `data` as follows: - - { 'd', 'e', ... } - - -This data may be the start of a new line, to be extracted by a subsequent `async_read_until` operation. - - - - -[endsect] - - - -[section:overload3 async_read_until (3 of 8 overloads)] - - -Start an asynchronous operation to read data into a dynamic buffer sequence until some part of its data matches a regular expression. - - - template< - typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, - typename ``[link boost_asio.reference.DynamicBuffer DynamicBuffer]``, - typename ``[link boost_asio.reference.ReadHandler ReadHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_until( - AsyncReadStream & s, - DynamicBuffer && buffers, - const boost::regex & expr, - ReadHandler && handler); - - -This function is used to asynchronously read data into the specified dynamic buffer sequence until the dynamic buffer sequence's get area contains some data that matches a regular expression. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true: - - -* A substring of the dynamic buffer sequence's get area matches the regular expression. - - -* An error occurred. - -This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. If the dynamic buffer sequence's get area already contains data that matches the regular expression, this asynchronous operation completes immediately. The program must ensure that the stream performs no other read operations (such as async\_read, async\_read\_until, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes. - - -[heading Parameters] - - -[variablelist - -[[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]] - -[[buffers][The dynamic buffer sequence into which the data will be read. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]] - -[[expr][The regular expression.]] - -[[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: -`` - void handler( - // Result of operation. - const boost::system::error_code& error, - - // The number of bytes in the dynamic buffer - // sequence's get area up to and including the - // substring that matches the regular expression. - // 0 if an error occurred. - std::size_t bytes_transferred - ); -`` -Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_context::post()`.]] - -] - - -[heading Remarks] - -After a successful async\_read\_until operation, the dynamic buffer sequence may contain additional data beyond that which matched the regular expression. An application will typically leave that data in the dynamic buffer sequence for a subsequent async\_read\_until operation to examine. - - -[heading Example] - -To asynchronously read data into a `std::string` until a CR-LF sequence is encountered: - - std::string data; - ... - void handler(const boost::system::error_code& e, std::size_t size) - { - if (!e) - { - std::string line = data.substr(0, n); - data.erase(0, n); - ... - } - } - ... - boost::asio::async_read_until(s, data, - boost::regex("\r\n"), handler); - - -After the `async_read_until` operation completes successfully, the string `data` contains the data which matched the regular expression: - - { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... } - - -The call to `substr` then extracts the data up to and including the match, so that the string `line` contains: - - { 'a', 'b', ..., 'c', '\r', '\n' } - - -After the call to `erase`, the remaining data is left in the string `data` as follows: - - { 'd', 'e', ... } - - -This data may be the start of a new line, to be extracted by a subsequent `async_read_until` operation. - - - - -[endsect] - - - -[section:overload4 async_read_until (4 of 8 overloads)] - - -Start an asynchronous operation to read data into a dynamic buffer sequence until a function object indicates a match. - - - template< - typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, - typename ``[link boost_asio.reference.DynamicBuffer DynamicBuffer]``, - typename MatchCondition, - typename ``[link boost_asio.reference.ReadHandler ReadHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_until( - AsyncReadStream & s, - DynamicBuffer && buffers, - MatchCondition match_condition, - ReadHandler && handler, - typename enable_if< is_match_condition< MatchCondition >::value >::type * = 0); - - -This function is used to asynchronously read data into the specified dynamic buffer sequence until a user-defined match condition function object, when applied to the data contained in the dynamic buffer sequence, indicates a successful match. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true: - - -* The match condition function object returns a std::pair where the second element evaluates to true. - - -* An error occurred. - -This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. If the match condition function object already indicates a match, this asynchronous operation completes immediately. The program must ensure that the stream performs no other read operations (such as async\_read, async\_read\_until, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes. - - -[heading Parameters] - - -[variablelist - -[[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]] - -[[buffers][The dynamic buffer sequence into which the data will be read. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]] - -[[match_condition][The function object to be called to determine whether a match exists. The signature of the function object must be: -`` - pair match_condition(iterator begin, iterator end); -`` -where `iterator` represents the type: -`` - buffers_iterator -`` -The iterator parameters `begin` and `end` define the range of bytes to be scanned to determine whether there is a match. The `first` member of the return value is an iterator marking one-past-the-end of the bytes that have been consumed by the match function. This iterator is used to calculate the `begin` parameter for any subsequent invocation of the match condition. The `second` member of the return value is true if a match has been found, false otherwise.]] - -[[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: -`` - void handler( - // Result of operation. - const boost::system::error_code& error, - - // The number of bytes in the dynamic buffer sequence's - // get area that have been fully consumed by the match - // function. O if an error occurred. - std::size_t bytes_transferred - ); -`` -Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_context::post()`.]] - -] - - -[heading Remarks] - -After a successful async\_read\_until operation, the dynamic buffer sequence may contain additional data beyond that which matched the function object. An application will typically leave that data in the dynamic buffer sequence for a subsequent async\_read\_until operation to examine. - -The default implementation of the `is_match_condition` type trait evaluates to true for function pointers and function objects with a `result_type` typedef. It must be specialised for other user-defined function objects. - - -[heading Examples] - -To asynchronously read data into a `std::string` until whitespace is encountered: - - typedef boost::asio::buffers_iterator< - boost::asio::const_buffers_1> iterator; - - std::pair - match_whitespace(iterator begin, iterator end) - { - iterator i = begin; - while (i != end) - if (std::isspace(*i++)) - return std::make_pair(i, true); - return std::make_pair(i, false); - } - ... - void handler(const boost::system::error_code& e, std::size_t size); - ... - std::string data; - boost::asio::async_read_until(s, data, match_whitespace, handler); - - - - -To asynchronously read data into a `std::string` until a matching character is found: - - class match_char - { - public: - explicit match_char(char c) : c_(c) {} - - template - std::pair operator()( - Iterator begin, Iterator end) const - { - Iterator i = begin; - while (i != end) - if (c_ == *i++) - return std::make_pair(i, true); - return std::make_pair(i, false); - } - - private: - char c_; - }; - - namespace asio { - template <> struct is_match_condition - : public boost::true_type {}; - } // namespace asio - ... - void handler(const boost::system::error_code& e, std::size_t size); - ... - std::string data; - boost::asio::async_read_until(s, data, match_char('a'), handler); - - - - - -[endsect] - - - -[section:overload5 async_read_until (5 of 8 overloads)] - - -Start an asynchronous operation to read data into a streambuf until it contains a specified delimiter. - - - template< - typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, - typename Allocator, - typename ``[link boost_asio.reference.ReadHandler ReadHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_until( - AsyncReadStream & s, - boost::asio::basic_streambuf< Allocator > & b, - char delim, - ReadHandler && handler); - - -This function is used to asynchronously read data into the specified streambuf until the streambuf's get area contains the specified delimiter. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true: - - -* The get area of the streambuf contains the specified delimiter. - - -* An error occurred. - -This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. If the streambuf's get area already contains the delimiter, this asynchronous operation completes immediately. The program must ensure that the stream performs no other read operations (such as async\_read, async\_read\_until, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes. - - -[heading Parameters] - - -[variablelist - -[[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]] - -[[b][A streambuf object into which the data will be read. Ownership of the streambuf is retained by the caller, which must guarantee that it remains valid until the handler is called.]] - -[[delim][The delimiter character.]] - -[[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: -`` - void handler( - // Result of operation. - const boost::system::error_code& error, - - // The number of bytes in the streambuf's get - // area up to and including the delimiter. - // 0 if an error occurred. - std::size_t bytes_transferred - ); -`` -Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_context::post()`.]] - -] - - -[heading Remarks] - -After a successful async\_read\_until operation, the streambuf may contain additional data beyond the delimiter. An application will typically leave that data in the streambuf for a subsequent async\_read\_until operation to examine. - - -[heading Example] - -To asynchronously read data into a streambuf until a newline is encountered: - - boost::asio::streambuf b; - ... - void handler(const boost::system::error_code& e, std::size_t size) - { - if (!e) - { - std::istream is(&b); - std::string line; - std::getline(is, line); - ... - } - } - ... - boost::asio::async_read_until(s, b, '\n', handler); - - -After the `async_read_until` operation completes successfully, the buffer `b` contains the delimiter: - - { 'a', 'b', ..., 'c', '\n', 'd', 'e', ... } - - -The call to `std::getline` then extracts the data up to and including the newline (which is discarded), so that the string `line` contains: - - { 'a', 'b', ..., 'c' } - - -The remaining data is left in the buffer `b` as follows: - - { 'd', 'e', ... } - - -This data may be the start of a new line, to be extracted by a subsequent `async_read_until` operation. - - - - -[endsect] - - - -[section:overload6 async_read_until (6 of 8 overloads)] - - -Start an asynchronous operation to read data into a streambuf until it contains a specified delimiter. - - - template< - typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, - typename Allocator, - typename ``[link boost_asio.reference.ReadHandler ReadHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_until( - AsyncReadStream & s, - boost::asio::basic_streambuf< Allocator > & b, - string_view delim, - ReadHandler && handler); - - -This function is used to asynchronously read data into the specified streambuf until the streambuf's get area contains the specified delimiter. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true: - - -* The get area of the streambuf contains the specified delimiter. - - -* An error occurred. - -This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. If the streambuf's get area already contains the delimiter, this asynchronous operation completes immediately. The program must ensure that the stream performs no other read operations (such as async\_read, async\_read\_until, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes. - - -[heading Parameters] - - -[variablelist - -[[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]] - -[[b][A streambuf object into which the data will be read. Ownership of the streambuf is retained by the caller, which must guarantee that it remains valid until the handler is called.]] - -[[delim][The delimiter string.]] - -[[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: -`` - void handler( - // Result of operation. - const boost::system::error_code& error, - - // The number of bytes in the streambuf's get - // area up to and including the delimiter. - // 0 if an error occurred. - std::size_t bytes_transferred - ); -`` -Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_context::post()`.]] - -] - - -[heading Remarks] - -After a successful async\_read\_until operation, the streambuf may contain additional data beyond the delimiter. An application will typically leave that data in the streambuf for a subsequent async\_read\_until operation to examine. - - -[heading Example] - -To asynchronously read data into a streambuf until a newline is encountered: - - boost::asio::streambuf b; - ... - void handler(const boost::system::error_code& e, std::size_t size) - { - if (!e) - { - std::istream is(&b); - std::string line; - std::getline(is, line); - ... - } - } - ... - boost::asio::async_read_until(s, b, "\r\n", handler); - - -After the `async_read_until` operation completes successfully, the buffer `b` contains the delimiter: - - { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... } - - -The call to `std::getline` then extracts the data up to and including the newline (which is discarded), so that the string `line` contains: - - { 'a', 'b', ..., 'c', '\r' } - - -The remaining data is left in the buffer `b` as follows: - - { 'd', 'e', ... } - - -This data may be the start of a new line, to be extracted by a subsequent `async_read_until` operation. - - - - -[endsect] - - - -[section:overload7 async_read_until (7 of 8 overloads)] - - -Start an asynchronous operation to read data into a streambuf until some part of its data matches a regular expression. - - - template< - typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, - typename Allocator, - typename ``[link boost_asio.reference.ReadHandler ReadHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_until( - AsyncReadStream & s, - boost::asio::basic_streambuf< Allocator > & b, - const boost::regex & expr, - ReadHandler && handler); - - -This function is used to asynchronously read data into the specified streambuf until the streambuf's get area contains some data that matches a regular expression. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true: - - -* A substring of the streambuf's get area matches the regular expression. - - -* An error occurred. - -This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. If the streambuf's get area already contains data that matches the regular expression, this asynchronous operation completes immediately. The program must ensure that the stream performs no other read operations (such as async\_read, async\_read\_until, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes. - - -[heading Parameters] - - -[variablelist - -[[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]] - -[[b][A streambuf object into which the data will be read. Ownership of the streambuf is retained by the caller, which must guarantee that it remains valid until the handler is called.]] - -[[expr][The regular expression.]] - -[[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: -`` - void handler( - // Result of operation. - const boost::system::error_code& error, - - // The number of bytes in the streambuf's get - // area up to and including the substring - // that matches the regular. expression. - // 0 if an error occurred. - std::size_t bytes_transferred - ); -`` -Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_context::post()`.]] - -] - - -[heading Remarks] - -After a successful async\_read\_until operation, the streambuf may contain additional data beyond that which matched the regular expression. An application will typically leave that data in the streambuf for a subsequent async\_read\_until operation to examine. - - -[heading Example] - -To asynchronously read data into a streambuf until a CR-LF sequence is encountered: - - boost::asio::streambuf b; - ... - void handler(const boost::system::error_code& e, std::size_t size) - { - if (!e) - { - std::istream is(&b); - std::string line; - std::getline(is, line); - ... - } - } - ... - boost::asio::async_read_until(s, b, boost::regex("\r\n"), handler); - - -After the `async_read_until` operation completes successfully, the buffer `b` contains the data which matched the regular expression: - - { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... } - - -The call to `std::getline` then extracts the data up to and including the newline (which is discarded), so that the string `line` contains: - - { 'a', 'b', ..., 'c', '\r' } - - -The remaining data is left in the buffer `b` as follows: - - { 'd', 'e', ... } - - -This data may be the start of a new line, to be extracted by a subsequent `async_read_until` operation. - - - - -[endsect] - - - -[section:overload8 async_read_until (8 of 8 overloads)] - - -Start an asynchronous operation to read data into a streambuf until a function object indicates a match. - - - template< - typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``, - typename Allocator, - typename MatchCondition, - typename ``[link boost_asio.reference.ReadHandler ReadHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_read_until( - AsyncReadStream & s, - boost::asio::basic_streambuf< Allocator > & b, - MatchCondition match_condition, - ReadHandler && handler, - typename enable_if< is_match_condition< MatchCondition >::value >::type * = 0); - - -This function is used to asynchronously read data into the specified streambuf until a user-defined match condition function object, when applied to the data contained in the streambuf, indicates a successful match. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true: - - -* The match condition function object returns a std::pair where the second element evaluates to true. - - -* An error occurred. - -This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function, and is known as a ['composed operation]. If the match condition function object already indicates a match, this asynchronous operation completes immediately. The program must ensure that the stream performs no other read operations (such as async\_read, async\_read\_until, the stream's async\_read\_some function, or any other composed operations that perform reads) until this operation completes. - - -[heading Parameters] - - -[variablelist - -[[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]] - -[[b][A streambuf object into which the data will be read.]] - -[[match_condition][The function object to be called to determine whether a match exists. The signature of the function object must be: -`` - pair match_condition(iterator begin, iterator end); -`` -where `iterator` represents the type: -`` - buffers_iterator::const_buffers_type> -`` -The iterator parameters `begin` and `end` define the range of bytes to be scanned to determine whether there is a match. The `first` member of the return value is an iterator marking one-past-the-end of the bytes that have been consumed by the match function. This iterator is used to calculate the `begin` parameter for any subsequent invocation of the match condition. The `second` member of the return value is true if a match has been found, false otherwise.]] - -[[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be: -`` - void handler( - // Result of operation. - const boost::system::error_code& error, - - // The number of bytes in the streambuf's get - // area that have been fully consumed by the - // match function. O if an error occurred. - std::size_t bytes_transferred - ); -`` -Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_context::post()`.]] - -] - - -[heading Remarks] - -After a successful async\_read\_until operation, the streambuf may contain additional data beyond that which matched the function object. An application will typically leave that data in the streambuf for a subsequent async\_read\_until operation to examine. - -The default implementation of the `is_match_condition` type trait evaluates to true for function pointers and function objects with a `result_type` typedef. It must be specialised for other user-defined function objects. - - -[heading Examples] - -To asynchronously read data into a streambuf until whitespace is encountered: - - typedef boost::asio::buffers_iterator< - boost::asio::streambuf::const_buffers_type> iterator; - - std::pair - match_whitespace(iterator begin, iterator end) - { - iterator i = begin; - while (i != end) - if (std::isspace(*i++)) - return std::make_pair(i, true); - return std::make_pair(i, false); - } - ... - void handler(const boost::system::error_code& e, std::size_t size); - ... - boost::asio::streambuf b; - boost::asio::async_read_until(s, b, match_whitespace, handler); - - - - -To asynchronously read data into a streambuf until a matching character is found: - - class match_char - { - public: - explicit match_char(char c) : c_(c) {} - - template - std::pair operator()( - Iterator begin, Iterator end) const - { - Iterator i = begin; - while (i != end) - if (c_ == *i++) - return std::make_pair(i, true); - return std::make_pair(i, false); - } - - private: - char c_; - }; - - namespace asio { - template <> struct is_match_condition - : public boost::true_type {}; - } // namespace asio - ... - void handler(const boost::system::error_code& e, std::size_t size); - ... - boost::asio::streambuf b; - boost::asio::async_read_until(s, b, match_char('a'), handler); - - - - - -[endsect] - - -[endsect] - -[section:async_result async_result] - - -An interface for customising the behaviour of an initiating function. - - - template< - typename CompletionToken, - typename Signature> - class async_result - - -[heading Types] -[table - [[Name][Description]] - - [ - - [[link boost_asio.reference.async_result.completion_handler_type [*completion_handler_type]]] - [The concrete completion handler type for the specific signature. ] - - ] - - [ - - [[link boost_asio.reference.async_result.return_type [*return_type]]] - [The return type of the initiating function. ] - - ] - -] - -[heading Member Functions] -[table - [[Name][Description]] - - [ - [[link boost_asio.reference.async_result.async_result [*async_result]]] - [Construct an async result from a given handler. ] - ] - - [ - [[link boost_asio.reference.async_result.get [*get]]] - [Obtain the value to be returned from the initiating function. ] - ] - -] - -The [link boost_asio.reference.async_result `async_result`] traits class is used for determining: - - -* the concrete completion handler type to be called at the end of the asynchronous operation; - - -* the initiating function return type; and - - -* how the return value of the initiating function is obtained. - -The trait allows the handler and return types to be determined at the point where the specific completion handler signature is known. - -This template may be specialised for user-defined completion token types. The primary template assumes that the CompletionToken is the completion handler. - -[heading Requirements] - -['Header: ][^boost/asio/async_result.hpp] - -['Convenience header: ][^boost/asio.hpp] - - -[section:async_result async_result::async_result] - -[indexterm2 boost_asio.indexterm.async_result.async_result..async_result..async_result] -Construct an async result from a given handler. - - - async_result( - completion_handler_type & h); - - -When using a specalised [link boost_asio.reference.async_result `async_result`], the constructor has an opportunity to initialise some state associated with the completion handler, which is then returned from the initiating function. - - -[endsect] - - - -[section:completion_handler_type async_result::completion_handler_type] - -[indexterm2 boost_asio.indexterm.async_result.completion_handler_type..completion_handler_type..async_result] -The concrete completion handler type for the specific signature. - - - typedef CompletionToken completion_handler_type; - - - -[heading Requirements] - -['Header: ][^boost/asio/async_result.hpp] - -['Convenience header: ][^boost/asio.hpp] - - -[endsect] - - - -[section:get async_result::get] - -[indexterm2 boost_asio.indexterm.async_result.get..get..async_result] -Obtain the value to be returned from the initiating function. - - - return_type get(); - - - -[endsect] - - - -[section:return_type async_result::return_type] - -[indexterm2 boost_asio.indexterm.async_result.return_type..return_type..async_result] -The return type of the initiating function. - - - typedef void return_type; - - - -[heading Requirements] - -['Header: ][^boost/asio/async_result.hpp] - -['Convenience header: ][^boost/asio.hpp] - - -[endsect] - - - -[endsect] - -[section:async_result_lt__Handler__gt_ async_result< Handler >] - - -(Deprecated: Use two-parameter version of [link boost_asio.reference.async_result `async_result`].) An interface for customising the behaviour of an initiating function. - - - template< - typename ``[link boost_asio.reference.Handler Handler]``> - class async_result< Handler > - - -[heading Types] -[table - [[Name][Description]] - - [ - - [[link boost_asio.reference.async_result_lt__Handler__gt_.type [*type]]] - [The return type of the initiating function. ] - - ] - -] - -[heading Member Functions] -[table - [[Name][Description]] - - [ - [[link boost_asio.reference.async_result_lt__Handler__gt_.async_result [*async_result]]] - [Construct an async result from a given handler. ] - ] - - [ - [[link boost_asio.reference.async_result_lt__Handler__gt_.get [*get]]] - [Obtain the value to be returned from the initiating function. ] - ] - -] - -This template may be specialised for user-defined handler types. - -[heading Requirements] - -['Header: ][^boost/asio/async_result.hpp] - -['Convenience header: ][^boost/asio.hpp] - - -[section:async_result async_result< Handler >::async_result] - -[indexterm2 boost_asio.indexterm.async_result_lt__Handler__gt_.async_result..async_result..async_result< Handler >] -Construct an async result from a given handler. - - - async_result( - Handler & ); - - -When using a specalised [link boost_asio.reference.async_result `async_result`], the constructor has an opportunity to initialise some state associated with the handler, which is then returned from the initiating function. - - -[endsect] - - - -[section:get async_result< Handler >::get] - -[indexterm2 boost_asio.indexterm.async_result_lt__Handler__gt_.get..get..async_result< Handler >] -Obtain the value to be returned from the initiating function. - - - type get(); - - - -[endsect] - - - -[section:type async_result< Handler >::type] - -[indexterm2 boost_asio.indexterm.async_result_lt__Handler__gt_.type..type..async_result< Handler >] -The return type of the initiating function. - - - typedef void type; - - - -[heading Requirements] - -['Header: ][^boost/asio/async_result.hpp] - -['Convenience header: ][^boost/asio.hpp] - - -[endsect] - - - -[endsect] - -[section:async_result_lt__std__packaged_task_lt__Result_lp_Args_ellipsis__rp__gt__comma__Signature__gt_ async_result< std::packaged_task< Result(Args...)>, Signature >] - - -Partial specialisation of `async_result` for `std::packaged_task`. - - - template< - typename Result, - typename... Args, - typename Signature> - class async_result< std::packaged_task< Result(Args...)>, Signature > - - -[heading Types] -[table - [[Name][Description]] - - [ - - [[link boost_asio.reference.async_result_lt__std__packaged_task_lt__Result_lp_Args_ellipsis__rp__gt__comma__Signature__gt_.completion_handler_type [*completion_handler_type]]] - [The packaged task is the concrete completion handler type. ] - - ] - - [ - - [[link boost_asio.reference.async_result_lt__std__packaged_task_lt__Result_lp_Args_ellipsis__rp__gt__comma__Signature__gt_.return_type [*return_type]]] - [The return type of the initiating function is the future obtained from the packaged task. ] - - ] - -] - -[heading Member Functions] -[table - [[Name][Description]] - - [ - [[link boost_asio.reference.async_result_lt__std__packaged_task_lt__Result_lp_Args_ellipsis__rp__gt__comma__Signature__gt_.async_result [*async_result]]] - [The constructor extracts the future from the packaged task. ] - ] - - [ - [[link boost_asio.reference.async_result_lt__std__packaged_task_lt__Result_lp_Args_ellipsis__rp__gt__comma__Signature__gt_.get [*get]]] - [Returns the packaged task's future. ] - ] - -] - -[heading Requirements] - -['Header: ][^boost/asio/packaged_task.hpp] - -['Convenience header: ][^boost/asio.hpp] - - -[section:async_result async_result< std::packaged_task< Result(Args...)>, Signature >::async_result] - -[indexterm2 boost_asio.indexterm.async_result_lt__std__packaged_task_lt__Result_lp_Args_ellipsis__rp__gt__comma__Signature__gt_.async_result..async_result..async_result< std::packaged_task< Result(Args\.\.\.)>, Signature >] -The constructor extracts the future from the packaged task. - - - async_result( - completion_handler_type & h); - - - -[endsect] - - - -[section:completion_handler_type async_result< std::packaged_task< Result(Args...)>, Signature >::completion_handler_type] - -[indexterm2 boost_asio.indexterm.async_result_lt__std__packaged_task_lt__Result_lp_Args_ellipsis__rp__gt__comma__Signature__gt_.completion_handler_type..completion_handler_type..async_result< std::packaged_task< Result(Args\.\.\.)>, Signature >] -The packaged task is the concrete completion handler type. - - - typedef std::packaged_task< Result(Args...)> completion_handler_type; - - - -[heading Requirements] - -['Header: ][^boost/asio/packaged_task.hpp] - -['Convenience header: ][^boost/asio.hpp] - - -[endsect] - - - -[section:get async_result< std::packaged_task< Result(Args...)>, Signature >::get] - -[indexterm2 boost_asio.indexterm.async_result_lt__std__packaged_task_lt__Result_lp_Args_ellipsis__rp__gt__comma__Signature__gt_.get..get..async_result< std::packaged_task< Result(Args\.\.\.)>, Signature >] -Returns the packaged task's future. - - - return_type get(); - - - -[endsect] - - - -[section:return_type async_result< std::packaged_task< Result(Args...)>, Signature >::return_type] - -[indexterm2 boost_asio.indexterm.async_result_lt__std__packaged_task_lt__Result_lp_Args_ellipsis__rp__gt__comma__Signature__gt_.return_type..return_type..async_result< std::packaged_task< Result(Args\.\.\.)>, Signature >] -The return type of the initiating function is the future obtained from the packaged task. - - - typedef std::future< Result > return_type; - - - -[heading Requirements] - -['Header: ][^boost/asio/packaged_task.hpp] - -['Convenience header: ][^boost/asio.hpp] - - -[endsect] - - - -[endsect] - -[section:async_write async_write] - -[indexterm1 boost_asio.indexterm.async_write..async_write] -Start an asynchronous operation to write a certain amount of data to a stream. - - - template< - typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``, - typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, - typename ``[link boost_asio.reference.WriteHandler WriteHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_write.overload1 async_write]``( - AsyncWriteStream & s, - const ConstBufferSequence & buffers, - WriteHandler && handler, - typename enable_if< is_const_buffer_sequence< ConstBufferSequence >::value >::type * = 0); - `` [''''»''' [link boost_asio.reference.async_write.overload1 more...]]`` - - template< - typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``, - typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, - typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``, - typename ``[link boost_asio.reference.WriteHandler WriteHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_write.overload2 async_write]``( - AsyncWriteStream & s, - const ConstBufferSequence & buffers, - CompletionCondition completion_condition, - WriteHandler && handler, - typename enable_if< is_const_buffer_sequence< ConstBufferSequence >::value >::type * = 0); - `` [''''»''' [link boost_asio.reference.async_write.overload2 more...]]`` - - template< - typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``, - typename ``[link boost_asio.reference.DynamicBuffer DynamicBuffer]``, - typename ``[link boost_asio.reference.WriteHandler WriteHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_write.overload3 async_write]``( - AsyncWriteStream & s, - DynamicBuffer && buffers, - WriteHandler && handler, - typename enable_if< is_dynamic_buffer< typename decay< DynamicBuffer >::type >::value >::type * = 0); - `` [''''»''' [link boost_asio.reference.async_write.overload3 more...]]`` - - template< - typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``, - typename ``[link boost_asio.reference.DynamicBuffer DynamicBuffer]``, - typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``, - typename ``[link boost_asio.reference.WriteHandler WriteHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_write.overload4 async_write]``( - AsyncWriteStream & s, - DynamicBuffer && buffers, - CompletionCondition completion_condition, - WriteHandler && handler, - typename enable_if< is_dynamic_buffer< typename decay< DynamicBuffer >::type >::value >::type * = 0); - `` [''''»''' [link boost_asio.reference.async_write.overload4 more...]]`` - - template< - typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``, - typename Allocator, - typename ``[link boost_asio.reference.WriteHandler WriteHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_write.overload5 async_write]``( - AsyncWriteStream & s, - basic_streambuf< Allocator > & b, - WriteHandler && handler); - `` [''''»''' [link boost_asio.reference.async_write.overload5 more...]]`` - - template< - typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``, - typename Allocator, - typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``, - typename ``[link boost_asio.reference.WriteHandler WriteHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_write.overload6 async_write]``( - AsyncWriteStream & s, - basic_streambuf< Allocator > & b, - CompletionCondition completion_condition, - WriteHandler && handler); - `` [''''»''' [link boost_asio.reference.async_write.overload6 more...]]`` - -[heading Requirements] - -['Header: ][^boost/asio/write.hpp] - -['Convenience header: ][^boost/asio.hpp] - - -[section:overload1 async_write (1 of 6 overloads)] - - -Start an asynchronous operation to write all of the supplied data to a stream. - - - template< - typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``, - typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, - typename ``[link boost_asio.reference.WriteHandler WriteHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write( - AsyncWriteStream & s, - const ConstBufferSequence & buffers, - WriteHandler && handler, - typename enable_if< is_const_buffer_sequence< ConstBufferSequence >::value >::type * = 0); - - -This function is used to asynchronously write a certain number of bytes of data to a stream. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true: - - -* All of the data in the supplied buffers has been written. That is, the bytes transferred is equal to the sum of the buffer sizes. - - -* An error occurred. - -This operation is implemented in terms of zero or more calls to the stream's async\_write\_some function, and is known as a ['composed operation]. The program must ensure that the stream performs no other write operations (such as async\_write, the stream's async\_write\_some function, or any other composed operations that perform writes) until this operation completes. - - -[heading Parameters] - - -[variablelist - -[[s][The stream to which the data is to be written. The type must support the AsyncWriteStream concept.]] - -[[buffers][One or more buffers containing the data to be written. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]] - -[[handler][The handler to be called when the write operation completes. Copies will be made of the handler as required. The function signature of the handler must be: -`` - void handler( - const boost::system::error_code& error, // Result of operation. - - std::size_t bytes_transferred // Number of bytes written from the - // buffers. If an error occurred, - // this will be less than the sum - // of the buffer sizes. - ); -`` -Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_context::post()`.]] - -] - - -[heading Example] - -To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: - - boost::asio::async_write(s, boost::asio::buffer(data, size), handler); - - -See the [link boost_asio.reference.buffer `buffer`] documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. - - - - -[endsect] - - - -[section:overload2 async_write (2 of 6 overloads)] - - -Start an asynchronous operation to write a certain amount of data to a stream. - - - template< - typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``, - typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, - typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``, - typename ``[link boost_asio.reference.WriteHandler WriteHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write( - AsyncWriteStream & s, - const ConstBufferSequence & buffers, - CompletionCondition completion_condition, - WriteHandler && handler, - typename enable_if< is_const_buffer_sequence< ConstBufferSequence >::value >::type * = 0); - - -This function is used to asynchronously write a certain number of bytes of data to a stream. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true: - - -* All of the data in the supplied buffers has been written. That is, the bytes transferred is equal to the sum of the buffer sizes. - - -* The completion\_condition function object returns 0. - -This operation is implemented in terms of zero or more calls to the stream's async\_write\_some function, and is known as a ['composed operation]. The program must ensure that the stream performs no other write operations (such as async\_write, the stream's async\_write\_some function, or any other composed operations that perform writes) until this operation completes. - - -[heading Parameters] - - -[variablelist - -[[s][The stream to which the data is to be written. The type must support the AsyncWriteStream concept.]] - -[[buffers][One or more buffers containing the data to be written. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]] - -[[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be: -`` - std::size_t completion_condition( - // Result of latest async_write_some operation. - const boost::system::error_code& error, - - // Number of bytes transferred so far. - std::size_t bytes_transferred - ); -`` -A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the stream's async\_write\_some function.]] - -[[handler][The handler to be called when the write operation completes. Copies will be made of the handler as required. The function signature of the handler must be: -`` - void handler( - const boost::system::error_code& error, // Result of operation. - - std::size_t bytes_transferred // Number of bytes written from the - // buffers. If an error occurred, - // this will be less than the sum - // of the buffer sizes. - ); -`` -Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_context::post()`.]] - -] - - -[heading Example] - -To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: - - boost::asio::async_write(s, - boost::asio::buffer(data, size), - boost::asio::transfer_at_least(32), - handler); - - -See the [link boost_asio.reference.buffer `buffer`] documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. - - - - -[endsect] - - - -[section:overload3 async_write (3 of 6 overloads)] - - -Start an asynchronous operation to write all of the supplied data to a stream. - - - template< - typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``, - typename ``[link boost_asio.reference.DynamicBuffer DynamicBuffer]``, - typename ``[link boost_asio.reference.WriteHandler WriteHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write( - AsyncWriteStream & s, - DynamicBuffer && buffers, - WriteHandler && handler, - typename enable_if< is_dynamic_buffer< typename decay< DynamicBuffer >::type >::value >::type * = 0); - - -This function is used to asynchronously write a certain number of bytes of data to a stream. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true: - - -* All of the data in the supplied dynamic buffer sequence has been written. - - -* An error occurred. - -This operation is implemented in terms of zero or more calls to the stream's async\_write\_some function, and is known as a ['composed operation]. The program must ensure that the stream performs no other write operations (such as async\_write, the stream's async\_write\_some function, or any other composed operations that perform writes) until this operation completes. - - -[heading Parameters] - - -[variablelist - -[[s][The stream to which the data is to be written. The type must support the AsyncWriteStream concept.]] - -[[buffers][The dynamic buffer sequence from which data will be written. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called. Successfully written data is automatically consumed from the buffers.]] - -[[handler][The handler to be called when the write operation completes. Copies will be made of the handler as required. The function signature of the handler must be: -`` - void handler( - const boost::system::error_code& error, // Result of operation. - - std::size_t bytes_transferred // Number of bytes written from the - // buffers. If an error occurred, - // this will be less than the sum - // of the buffer sizes. - ); -`` -Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_context::post()`. ]] - -] - - - - -[endsect] - - - -[section:overload4 async_write (4 of 6 overloads)] - - -Start an asynchronous operation to write a certain amount of data to a stream. - - - template< - typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``, - typename ``[link boost_asio.reference.DynamicBuffer DynamicBuffer]``, - typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``, - typename ``[link boost_asio.reference.WriteHandler WriteHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write( - AsyncWriteStream & s, - DynamicBuffer && buffers, - CompletionCondition completion_condition, - WriteHandler && handler, - typename enable_if< is_dynamic_buffer< typename decay< DynamicBuffer >::type >::value >::type * = 0); - - -This function is used to asynchronously write a certain number of bytes of data to a stream. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true: - - -* All of the data in the supplied dynamic buffer sequence has been written. - - -* The completion\_condition function object returns 0. - -This operation is implemented in terms of zero or more calls to the stream's async\_write\_some function, and is known as a ['composed operation]. The program must ensure that the stream performs no other write operations (such as async\_write, the stream's async\_write\_some function, or any other composed operations that perform writes) until this operation completes. - - -[heading Parameters] - - -[variablelist - -[[s][The stream to which the data is to be written. The type must support the AsyncWriteStream concept.]] - -[[buffers][The dynamic buffer sequence from which data will be written. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called. Successfully written data is automatically consumed from the buffers.]] - -[[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be: -`` - std::size_t completion_condition( - // Result of latest async_write_some operation. - const boost::system::error_code& error, - - // Number of bytes transferred so far. - std::size_t bytes_transferred - ); -`` -A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the stream's async\_write\_some function.]] - -[[handler][The handler to be called when the write operation completes. Copies will be made of the handler as required. The function signature of the handler must be: -`` - void handler( - const boost::system::error_code& error, // Result of operation. - - std::size_t bytes_transferred // Number of bytes written from the - // buffers. If an error occurred, - // this will be less than the sum - // of the buffer sizes. - ); -`` -Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_context::post()`. ]] - -] - - - - -[endsect] - - - -[section:overload5 async_write (5 of 6 overloads)] - - -Start an asynchronous operation to write all of the supplied data to a stream. - - - template< - typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``, - typename Allocator, - typename ``[link boost_asio.reference.WriteHandler WriteHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write( - AsyncWriteStream & s, - basic_streambuf< Allocator > & b, - WriteHandler && handler); - - -This function is used to asynchronously write a certain number of bytes of data to a stream. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true: - - -* All of the data in the supplied [link boost_asio.reference.basic_streambuf `basic_streambuf`] has been written. - - -* An error occurred. - -This operation is implemented in terms of zero or more calls to the stream's async\_write\_some function, and is known as a ['composed operation]. The program must ensure that the stream performs no other write operations (such as async\_write, the stream's async\_write\_some function, or any other composed operations that perform writes) until this operation completes. - - -[heading Parameters] - - -[variablelist - -[[s][The stream to which the data is to be written. The type must support the AsyncWriteStream concept.]] - -[[b][A [link boost_asio.reference.basic_streambuf `basic_streambuf`] object from which data will be written. Ownership of the streambuf is retained by the caller, which must guarantee that it remains valid until the handler is called.]] - -[[handler][The handler to be called when the write operation completes. Copies will be made of the handler as required. The function signature of the handler must be: -`` - void handler( - const boost::system::error_code& error, // Result of operation. - - std::size_t bytes_transferred // Number of bytes written from the - // buffers. If an error occurred, - // this will be less than the sum - // of the buffer sizes. - ); -`` -Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_context::post()`. ]] - -] - - - - -[endsect] - - - -[section:overload6 async_write (6 of 6 overloads)] - - -Start an asynchronous operation to write a certain amount of data to a stream. - - - template< - typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``, - typename Allocator, - typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``, - typename ``[link boost_asio.reference.WriteHandler WriteHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write( - AsyncWriteStream & s, - basic_streambuf< Allocator > & b, - CompletionCondition completion_condition, - WriteHandler && handler); - - -This function is used to asynchronously write a certain number of bytes of data to a stream. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true: - - -* All of the data in the supplied [link boost_asio.reference.basic_streambuf `basic_streambuf`] has been written. - - -* The completion\_condition function object returns 0. - -This operation is implemented in terms of zero or more calls to the stream's async\_write\_some function, and is known as a ['composed operation]. The program must ensure that the stream performs no other write operations (such as async\_write, the stream's async\_write\_some function, or any other composed operations that perform writes) until this operation completes. - - -[heading Parameters] - - -[variablelist - -[[s][The stream to which the data is to be written. The type must support the AsyncWriteStream concept.]] - -[[b][A [link boost_asio.reference.basic_streambuf `basic_streambuf`] object from which data will be written. Ownership of the streambuf is retained by the caller, which must guarantee that it remains valid until the handler is called.]] - -[[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be: -`` - std::size_t completion_condition( - // Result of latest async_write_some operation. - const boost::system::error_code& error, - - // Number of bytes transferred so far. - std::size_t bytes_transferred - ); -`` -A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the stream's async\_write\_some function.]] - -[[handler][The handler to be called when the write operation completes. Copies will be made of the handler as required. The function signature of the handler must be: -`` - void handler( - const boost::system::error_code& error, // Result of operation. - - std::size_t bytes_transferred // Number of bytes written from the - // buffers. If an error occurred, - // this will be less than the sum - // of the buffer sizes. - ); -`` -Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_context::post()`. ]] - -] - - - - -[endsect] - - -[endsect] - -[section:async_write_at async_write_at] - -[indexterm1 boost_asio.indexterm.async_write_at..async_write_at] -Start an asynchronous operation to write a certain amount of data at the specified offset. - - - template< - typename ``[link boost_asio.reference.AsyncRandomAccessWriteDevice AsyncRandomAccessWriteDevice]``, - typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, - typename ``[link boost_asio.reference.WriteHandler WriteHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_write_at.overload1 async_write_at]``( - AsyncRandomAccessWriteDevice & d, - uint64_t offset, - const ConstBufferSequence & buffers, - WriteHandler && handler); - `` [''''»''' [link boost_asio.reference.async_write_at.overload1 more...]]`` - - template< - typename ``[link boost_asio.reference.AsyncRandomAccessWriteDevice AsyncRandomAccessWriteDevice]``, - typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, - typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``, - typename ``[link boost_asio.reference.WriteHandler WriteHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_write_at.overload2 async_write_at]``( - AsyncRandomAccessWriteDevice & d, - uint64_t offset, - const ConstBufferSequence & buffers, - CompletionCondition completion_condition, - WriteHandler && handler); - `` [''''»''' [link boost_asio.reference.async_write_at.overload2 more...]]`` - - template< - typename ``[link boost_asio.reference.AsyncRandomAccessWriteDevice AsyncRandomAccessWriteDevice]``, - typename Allocator, - typename ``[link boost_asio.reference.WriteHandler WriteHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_write_at.overload3 async_write_at]``( - AsyncRandomAccessWriteDevice & d, - uint64_t offset, - basic_streambuf< Allocator > & b, - WriteHandler && handler); - `` [''''»''' [link boost_asio.reference.async_write_at.overload3 more...]]`` - - template< - typename ``[link boost_asio.reference.AsyncRandomAccessWriteDevice AsyncRandomAccessWriteDevice]``, - typename Allocator, - typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``, - typename ``[link boost_asio.reference.WriteHandler WriteHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.async_write_at.overload4 async_write_at]``( - AsyncRandomAccessWriteDevice & d, - uint64_t offset, - basic_streambuf< Allocator > & b, - CompletionCondition completion_condition, - WriteHandler && handler); - `` [''''»''' [link boost_asio.reference.async_write_at.overload4 more...]]`` - -[heading Requirements] - -['Header: ][^boost/asio/write_at.hpp] - -['Convenience header: ][^boost/asio.hpp] - - -[section:overload1 async_write_at (1 of 4 overloads)] - - -Start an asynchronous operation to write all of the supplied data at the specified offset. - - - template< - typename ``[link boost_asio.reference.AsyncRandomAccessWriteDevice AsyncRandomAccessWriteDevice]``, - typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, - typename ``[link boost_asio.reference.WriteHandler WriteHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write_at( - AsyncRandomAccessWriteDevice & d, - uint64_t offset, - const ConstBufferSequence & buffers, - WriteHandler && handler); - - -This function is used to asynchronously write a certain number of bytes of data to a random access device at a specified offset. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true: - - -* All of the data in the supplied buffers has been written. That is, the bytes transferred is equal to the sum of the buffer sizes. - - -* An error occurred. - -This operation is implemented in terms of zero or more calls to the device's async\_write\_some\_at function, and is known as a ['composed operation]. The program must ensure that the device performs no ['overlapping] write operations (such as async\_write\_at, the device's async\_write\_some\_at function, or any other composed operations that perform writes) until this operation completes. Operations are overlapping if the regions defined by their offsets, and the numbers of bytes to write, intersect. - - -[heading Parameters] - - -[variablelist - -[[d][The device to which the data is to be written. The type must support the AsyncRandomAccessWriteDevice concept.]] - -[[offset][The offset at which the data will be written.]] - -[[buffers][One or more buffers containing the data to be written. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]] - -[[handler][The handler to be called when the write operation completes. Copies will be made of the handler as required. The function signature of the handler must be: -`` - void handler( - // Result of operation. - const boost::system::error_code& error, - - // Number of bytes written from the buffers. If an error - // occurred, this will be less than the sum of the buffer sizes. - std::size_t bytes_transferred - ); -`` -Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_context::post()`.]] - -] - - -[heading Example] - -To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: - - boost::asio::async_write_at(d, 42, boost::asio::buffer(data, size), handler); - - -See the [link boost_asio.reference.buffer `buffer`] documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. - - - - -[endsect] - - - -[section:overload2 async_write_at (2 of 4 overloads)] - - -Start an asynchronous operation to write a certain amount of data at the specified offset. - - - template< - typename ``[link boost_asio.reference.AsyncRandomAccessWriteDevice AsyncRandomAccessWriteDevice]``, - typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, - typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``, - typename ``[link boost_asio.reference.WriteHandler WriteHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write_at( - AsyncRandomAccessWriteDevice & d, - uint64_t offset, - const ConstBufferSequence & buffers, - CompletionCondition completion_condition, - WriteHandler && handler); - - -This function is used to asynchronously write a certain number of bytes of data to a random access device at a specified offset. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true: - - -* All of the data in the supplied buffers has been written. That is, the bytes transferred is equal to the sum of the buffer sizes. - - -* The completion\_condition function object returns 0. - -This operation is implemented in terms of zero or more calls to the device's async\_write\_some\_at function, and is known as a ['composed operation]. The program must ensure that the device performs no ['overlapping] write operations (such as async\_write\_at, the device's async\_write\_some\_at function, or any other composed operations that perform writes) until this operation completes. Operations are overlapping if the regions defined by their offsets, and the numbers of bytes to write, intersect. - - -[heading Parameters] - - -[variablelist - -[[d][The device to which the data is to be written. The type must support the AsyncRandomAccessWriteDevice concept.]] - -[[offset][The offset at which the data will be written.]] - -[[buffers][One or more buffers containing the data to be written. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]] - -[[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be: -`` - std::size_t completion_condition( - // Result of latest async_write_some_at operation. - const boost::system::error_code& error, - - // Number of bytes transferred so far. - std::size_t bytes_transferred - ); -`` -A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the device's async\_write\_some\_at function.]] - -[[handler][The handler to be called when the write operation completes. Copies will be made of the handler as required. The function signature of the handler must be: -`` - void handler( - // Result of operation. - const boost::system::error_code& error, - - // Number of bytes written from the buffers. If an error - // occurred, this will be less than the sum of the buffer sizes. - std::size_t bytes_transferred - ); -`` -Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_context::post()`.]] - -] - - -[heading Example] - -To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: - - boost::asio::async_write_at(d, 42, - boost::asio::buffer(data, size), - boost::asio::transfer_at_least(32), - handler); - - -See the [link boost_asio.reference.buffer `buffer`] documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. - - - - -[endsect] - - - -[section:overload3 async_write_at (3 of 4 overloads)] - - -Start an asynchronous operation to write all of the supplied data at the specified offset. - - - template< - typename ``[link boost_asio.reference.AsyncRandomAccessWriteDevice AsyncRandomAccessWriteDevice]``, - typename Allocator, - typename ``[link boost_asio.reference.WriteHandler WriteHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write_at( - AsyncRandomAccessWriteDevice & d, - uint64_t offset, - basic_streambuf< Allocator > & b, - WriteHandler && handler); - - -This function is used to asynchronously write a certain number of bytes of data to a random access device at a specified offset. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true: - - -* All of the data in the supplied [link boost_asio.reference.basic_streambuf `basic_streambuf`] has been written. - - -* An error occurred. - -This operation is implemented in terms of zero or more calls to the device's async\_write\_some\_at function, and is known as a ['composed operation]. The program must ensure that the device performs no ['overlapping] write operations (such as async\_write\_at, the device's async\_write\_some\_at function, or any other composed operations that perform writes) until this operation completes. Operations are overlapping if the regions defined by their offsets, and the numbers of bytes to write, intersect. - - -[heading Parameters] - - -[variablelist - -[[d][The device to which the data is to be written. The type must support the AsyncRandomAccessWriteDevice concept.]] - -[[offset][The offset at which the data will be written.]] - -[[b][A [link boost_asio.reference.basic_streambuf `basic_streambuf`] object from which data will be written. Ownership of the streambuf is retained by the caller, which must guarantee that it remains valid until the handler is called.]] - -[[handler][The handler to be called when the write operation completes. Copies will be made of the handler as required. The function signature of the handler must be: -`` - void handler( - // Result of operation. - const boost::system::error_code& error, - - // Number of bytes written from the buffers. If an error - // occurred, this will be less than the sum of the buffer sizes. - std::size_t bytes_transferred - ); -`` -Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_context::post()`. ]] - -] - - - - -[endsect] - - - -[section:overload4 async_write_at (4 of 4 overloads)] - - -Start an asynchronous operation to write a certain amount of data at the specified offset. - - - template< - typename ``[link boost_asio.reference.AsyncRandomAccessWriteDevice AsyncRandomAccessWriteDevice]``, - typename Allocator, - typename ``[link boost_asio.reference.CompletionCondition CompletionCondition]``, - typename ``[link boost_asio.reference.WriteHandler WriteHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_write_at( - AsyncRandomAccessWriteDevice & d, - uint64_t offset, - basic_streambuf< Allocator > & b, - CompletionCondition completion_condition, - WriteHandler && handler); - - -This function is used to asynchronously write a certain number of bytes of data to a random access device at a specified offset. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true: - - -* All of the data in the supplied [link boost_asio.reference.basic_streambuf `basic_streambuf`] has been written. - - -* The completion\_condition function object returns 0. - -This operation is implemented in terms of zero or more calls to the device's async\_write\_some\_at function, and is known as a ['composed operation]. The program must ensure that the device performs no ['overlapping] write operations (such as async\_write\_at, the device's async\_write\_some\_at function, or any other composed operations that perform writes) until this operation completes. Operations are overlapping if the regions defined by their offsets, and the numbers of bytes to write, intersect. - - -[heading Parameters] - - -[variablelist - -[[d][The device to which the data is to be written. The type must support the AsyncRandomAccessWriteDevice concept.]] - -[[offset][The offset at which the data will be written.]] - -[[b][A [link boost_asio.reference.basic_streambuf `basic_streambuf`] object from which data will be written. Ownership of the streambuf is retained by the caller, which must guarantee that it remains valid until the handler is called.]] - -[[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be: -`` - std::size_t completion_condition( - // Result of latest async_write_some_at operation. - const boost::system::error_code& error, - - // Number of bytes transferred so far. - std::size_t bytes_transferred - ); -`` -A return value of 0 indicates that the write operation is complete. A non-zero return value indicates the maximum number of bytes to be written on the next call to the device's async\_write\_some\_at function.]] - -[[handler][The handler to be called when the write operation completes. Copies will be made of the handler as required. The function signature of the handler must be: -`` - void handler( - // Result of operation. - const boost::system::error_code& error, - - // Number of bytes written from the buffers. If an error - // occurred, this will be less than the sum of the buffer sizes. - std::size_t bytes_transferred - ); -`` -Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_context::post()`. ]] - -] - - - - -[endsect] - - -[endsect] - -[section:bad_executor bad_executor] - - -Exception thrown when trying to access an empty polymorphic executor. - - - class bad_executor : - public std::exception - - -[heading Member Functions] -[table - [[Name][Description]] - - [ - [[link boost_asio.reference.bad_executor.bad_executor [*bad_executor]]] - [Constructor. ] - ] - - [ - [[link boost_asio.reference.bad_executor.what [*what]]] - [Obtain message associated with exception. ] - ] - -] - -[heading Requirements] - -['Header: ][^boost/asio/executor.hpp] - -['Convenience header: ][^boost/asio.hpp] - - -[section:bad_executor bad_executor::bad_executor] - -[indexterm2 boost_asio.indexterm.bad_executor.bad_executor..bad_executor..bad_executor] -Constructor. - - - bad_executor(); - - - -[endsect] - - - -[section:what bad_executor::what] - -[indexterm2 boost_asio.indexterm.bad_executor.what..what..bad_executor] -Obtain message associated with exception. - - - virtual const char * what() const; - - - -[endsect] - - - -[endsect] - -[section:basic_datagram_socket basic_datagram_socket] - - -Provides datagram-oriented socket functionality. - - - template< - typename ``[link boost_asio.reference.Protocol Protocol]``> - class basic_datagram_socket : - public basic_socket< Protocol > - - -[heading Types] -[table - [[Name][Description]] - - [ - - [[link boost_asio.reference.basic_datagram_socket.broadcast [*broadcast]]] - [Socket option to permit sending of broadcast messages. ] - - ] - - [ - - [[link boost_asio.reference.basic_datagram_socket.bytes_readable [*bytes_readable]]] - [IO control command to get the amount of data that can be read without blocking. ] - - ] - - [ - - [[link boost_asio.reference.basic_datagram_socket.debug [*debug]]] - [Socket option to enable socket-level debugging. ] - - ] - - [ - - [[link boost_asio.reference.basic_datagram_socket.do_not_route [*do_not_route]]] - [Socket option to prevent routing, use local interfaces only. ] - - ] - - [ - - [[link boost_asio.reference.basic_datagram_socket.enable_connection_aborted [*enable_connection_aborted]]] - [Socket option to report aborted connections on accept. ] - - ] - - [ - - [[link boost_asio.reference.basic_datagram_socket.endpoint_type [*endpoint_type]]] - [The endpoint type. ] - - ] - - [ - - [[link boost_asio.reference.basic_datagram_socket.executor_type [*executor_type]]] - [The type of the executor associated with the object. ] - - ] - - [ - - [[link boost_asio.reference.basic_datagram_socket.keep_alive [*keep_alive]]] - [Socket option to send keep-alives. ] - - ] - - [ - - [[link boost_asio.reference.basic_datagram_socket.linger [*linger]]] - [Socket option to specify whether the socket lingers on close if unsent data is present. ] - - ] - - [ - - [[link boost_asio.reference.basic_datagram_socket.lowest_layer_type [*lowest_layer_type]]] - [A basic_socket is always the lowest layer. ] - - ] - - [ - - [[link boost_asio.reference.basic_datagram_socket.message_flags [*message_flags]]] - [Bitmask type for flags that can be passed to send and receive operations. ] - - ] - - [ - - [[link boost_asio.reference.basic_datagram_socket.native_handle_type [*native_handle_type]]] - [The native representation of a socket. ] - - ] - - [ - - [[link boost_asio.reference.basic_datagram_socket.out_of_band_inline [*out_of_band_inline]]] - [Socket option for putting received out-of-band data inline. ] - - ] - - [ - - [[link boost_asio.reference.basic_datagram_socket.protocol_type [*protocol_type]]] - [The protocol type. ] - - ] - - [ - - [[link boost_asio.reference.basic_datagram_socket.receive_buffer_size [*receive_buffer_size]]] - [Socket option for the receive buffer size of a socket. ] - - ] - - [ - - [[link boost_asio.reference.basic_datagram_socket.receive_low_watermark [*receive_low_watermark]]] - [Socket option for the receive low watermark. ] - - ] - - [ - - [[link boost_asio.reference.basic_datagram_socket.reuse_address [*reuse_address]]] - [Socket option to allow the socket to be bound to an address that is already in use. ] - - ] - - [ - - [[link boost_asio.reference.basic_datagram_socket.send_buffer_size [*send_buffer_size]]] - [Socket option for the send buffer size of a socket. ] - - ] - - [ - - [[link boost_asio.reference.basic_datagram_socket.send_low_watermark [*send_low_watermark]]] - [Socket option for the send low watermark. ] - - ] - - [ - - [[link boost_asio.reference.basic_datagram_socket.shutdown_type [*shutdown_type]]] - [Different ways a socket may be shutdown. ] - - ] - - [ - - [[link boost_asio.reference.basic_datagram_socket.wait_type [*wait_type]]] - [Wait types. ] - - ] - -] - -[heading Member Functions] -[table - [[Name][Description]] - - [ - [[link boost_asio.reference.basic_datagram_socket.assign [*assign]]] - [Assign an existing native socket to the socket. ] - ] - - [ - [[link boost_asio.reference.basic_datagram_socket.async_connect [*async_connect]]] - [Start an asynchronous connect. ] - ] - - [ - [[link boost_asio.reference.basic_datagram_socket.async_receive [*async_receive]]] - [Start an asynchronous receive on a connected socket. ] - ] - - [ - [[link boost_asio.reference.basic_datagram_socket.async_receive_from [*async_receive_from]]] - [Start an asynchronous receive. ] - ] - - [ - [[link boost_asio.reference.basic_datagram_socket.async_send [*async_send]]] - [Start an asynchronous send on a connected socket. ] - ] - - [ - [[link boost_asio.reference.basic_datagram_socket.async_send_to [*async_send_to]]] - [Start an asynchronous send. ] - ] - - [ - [[link boost_asio.reference.basic_datagram_socket.async_wait [*async_wait]]] - [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] - ] - - [ - [[link boost_asio.reference.basic_datagram_socket.at_mark [*at_mark]]] - [Determine whether the socket is at the out-of-band data mark. ] - ] - - [ - [[link boost_asio.reference.basic_datagram_socket.available [*available]]] - [Determine the number of bytes available for reading. ] - ] - - [ - [[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket [*basic_datagram_socket]]] - [Construct a basic_datagram_socket without opening it. - - Construct and open a basic_datagram_socket. - - Construct a basic_datagram_socket, opening it and binding it to the given local endpoint. - - Construct a basic_datagram_socket on an existing native socket. - - Move-construct a basic_datagram_socket from another. - - Move-construct a basic_datagram_socket from a socket of another protocol type. ] - ] - - [ - [[link boost_asio.reference.basic_datagram_socket.bind [*bind]]] - [Bind the socket to the given local endpoint. ] - ] - - [ - [[link boost_asio.reference.basic_datagram_socket.cancel [*cancel]]] - [Cancel all asynchronous operations associated with the socket. ] - ] - - [ - [[link boost_asio.reference.basic_datagram_socket.close [*close]]] - [Close the socket. ] - ] - - [ - [[link boost_asio.reference.basic_datagram_socket.connect [*connect]]] - [Connect the socket to the specified endpoint. ] - ] - - [ - [[link boost_asio.reference.basic_datagram_socket.get_executor [*get_executor]]] - [Get the executor associated with the object. ] - ] - - [ - [[link boost_asio.reference.basic_datagram_socket.get_io_context [*get_io_context]]] - [(Deprecated: Use get_executor().) Get the io_context associated with the object. ] - ] - - [ - [[link boost_asio.reference.basic_datagram_socket.get_io_service [*get_io_service]]] - [(Deprecated: Use get_executor().) Get the io_context associated with the object. ] - ] - - [ - [[link boost_asio.reference.basic_datagram_socket.get_option [*get_option]]] - [Get an option from the socket. ] - ] - - [ - [[link boost_asio.reference.basic_datagram_socket.io_control [*io_control]]] - [Perform an IO control command on the socket. ] - ] - - [ - [[link boost_asio.reference.basic_datagram_socket.is_open [*is_open]]] - [Determine whether the socket is open. ] - ] - - [ - [[link boost_asio.reference.basic_datagram_socket.local_endpoint [*local_endpoint]]] - [Get the local endpoint of the socket. ] - ] - - [ - [[link boost_asio.reference.basic_datagram_socket.lowest_layer [*lowest_layer]]] - [Get a reference to the lowest layer. - - Get a const reference to the lowest layer. ] - ] - - [ - [[link boost_asio.reference.basic_datagram_socket.native_handle [*native_handle]]] - [Get the native socket representation. ] - ] - - [ - [[link boost_asio.reference.basic_datagram_socket.native_non_blocking [*native_non_blocking]]] - [Gets the non-blocking mode of the native socket implementation. - - Sets the non-blocking mode of the native socket implementation. ] - ] - - [ - [[link boost_asio.reference.basic_datagram_socket.non_blocking [*non_blocking]]] - [Gets the non-blocking mode of the socket. - - Sets the non-blocking mode of the socket. ] - ] - - [ - [[link boost_asio.reference.basic_datagram_socket.open [*open]]] - [Open the socket using the specified protocol. ] - ] - - [ - [[link boost_asio.reference.basic_datagram_socket.operator_eq_ [*operator=]]] - [Move-assign a basic_datagram_socket from another. - - Move-assign a basic_datagram_socket from a socket of another protocol type. ] - ] - - [ - [[link boost_asio.reference.basic_datagram_socket.receive [*receive]]] - [Receive some data on a connected socket. ] - ] - - [ - [[link boost_asio.reference.basic_datagram_socket.receive_from [*receive_from]]] - [Receive a datagram with the endpoint of the sender. ] - ] - - [ - [[link boost_asio.reference.basic_datagram_socket.release [*release]]] - [Release ownership of the underlying native socket. ] - ] - - [ - [[link boost_asio.reference.basic_datagram_socket.remote_endpoint [*remote_endpoint]]] - [Get the remote endpoint of the socket. ] - ] - - [ - [[link boost_asio.reference.basic_datagram_socket.send [*send]]] - [Send some data on a connected socket. ] - ] - - [ - [[link boost_asio.reference.basic_datagram_socket.send_to [*send_to]]] - [Send a datagram to the specified endpoint. ] - ] - - [ - [[link boost_asio.reference.basic_datagram_socket.set_option [*set_option]]] - [Set an option on the socket. ] - ] - - [ - [[link boost_asio.reference.basic_datagram_socket.shutdown [*shutdown]]] - [Disable sends or receives on the socket. ] - ] - - [ - [[link boost_asio.reference.basic_datagram_socket.wait [*wait]]] - [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] - ] - - [ - [[link boost_asio.reference.basic_datagram_socket._basic_datagram_socket [*~basic_datagram_socket]]] - [Destroys the socket. ] - ] - -] - -[heading Data Members] -[table - [[Name][Description]] - - [ - [[link boost_asio.reference.basic_datagram_socket.max_connections [*max_connections]]] - [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ] - ] - - [ - [[link boost_asio.reference.basic_datagram_socket.max_listen_connections [*max_listen_connections]]] - [The maximum length of the queue of pending incoming connections. ] - ] - - [ - [[link boost_asio.reference.basic_datagram_socket.message_do_not_route [*message_do_not_route]]] - [Specify that the data should not be subject to routing. ] - ] - - [ - [[link boost_asio.reference.basic_datagram_socket.message_end_of_record [*message_end_of_record]]] - [Specifies that the data marks the end of a record. ] - ] - - [ - [[link boost_asio.reference.basic_datagram_socket.message_out_of_band [*message_out_of_band]]] - [Process out-of-band data. ] - ] - - [ - [[link boost_asio.reference.basic_datagram_socket.message_peek [*message_peek]]] - [Peek at incoming data without removing it from the input queue. ] - ] - -] - -The [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] class template provides asynchronous and blocking datagram-oriented socket functionality. - - -[heading Thread Safety] - -['Distinct] ['objects:] Safe. - -['Shared] ['objects:] Unsafe. - - - -[heading Requirements] - -['Header: ][^boost/asio/basic_datagram_socket.hpp] - -['Convenience header: ][^boost/asio.hpp] - -[section:assign basic_datagram_socket::assign] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.assign..assign..basic_datagram_socket] -Assign an existing native socket to the socket. - - - void ``[link boost_asio.reference.basic_datagram_socket.assign.overload1 assign]``( - const protocol_type & protocol, - const native_handle_type & native_socket); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.assign.overload1 more...]]`` - - void ``[link boost_asio.reference.basic_datagram_socket.assign.overload2 assign]``( - const protocol_type & protocol, - const native_handle_type & native_socket, - boost::system::error_code & ec); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.assign.overload2 more...]]`` - - -[section:overload1 basic_datagram_socket::assign (1 of 2 overloads)] - - -['Inherited from basic_socket.] - - -Assign an existing native socket to the socket. - - - void assign( - const protocol_type & protocol, - const native_handle_type & native_socket); - - - -[endsect] - - - -[section:overload2 basic_datagram_socket::assign (2 of 2 overloads)] - - -['Inherited from basic_socket.] - - -Assign an existing native socket to the socket. - - - void assign( - const protocol_type & protocol, - const native_handle_type & native_socket, - boost::system::error_code & ec); - - - -[endsect] - - -[endsect] - - -[section:async_connect basic_datagram_socket::async_connect] - - -['Inherited from basic_socket.] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.async_connect..async_connect..basic_datagram_socket] -Start an asynchronous connect. - - - template< - typename ``[link boost_asio.reference.ConnectHandler ConnectHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_connect( - const endpoint_type & peer_endpoint, - ConnectHandler && handler); - - -This function is used to asynchronously connect a socket to the specified remote endpoint. The function call always returns immediately. - -The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state. - - -[heading Parameters] - - -[variablelist - -[[peer_endpoint][The remote endpoint to which the socket will be connected. Copies will be made of the endpoint object as required.]] - -[[handler][The handler to be called when the connection operation completes. Copies will be made of the handler as required. The function signature of the handler must be: -`` - void handler( - const boost::system::error_code& error // Result of operation - ); -`` -Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_context::post()`.]] - -] - - -[heading Example] - - - - void connect_handler(const boost::system::error_code& error) - { - if (!error) - { - // Connect succeeded. - } - } - - ... - - boost::asio::ip::tcp::socket socket(io_context); - boost::asio::ip::tcp::endpoint endpoint( - boost::asio::ip::address::from_string("1.2.3.4"), 12345); - socket.async_connect(endpoint, connect_handler); - - - - - - - -[endsect] - - -[section:async_receive basic_datagram_socket::async_receive] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.async_receive..async_receive..basic_datagram_socket] -Start an asynchronous receive on a connected socket. - - - template< - typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, - typename ``[link boost_asio.reference.ReadHandler ReadHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.basic_datagram_socket.async_receive.overload1 async_receive]``( - const MutableBufferSequence & buffers, - ReadHandler && handler); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.async_receive.overload1 more...]]`` - - template< - typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, - typename ``[link boost_asio.reference.ReadHandler ReadHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.basic_datagram_socket.async_receive.overload2 async_receive]``( - const MutableBufferSequence & buffers, - socket_base::message_flags flags, - ReadHandler && handler); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.async_receive.overload2 more...]]`` - - -[section:overload1 basic_datagram_socket::async_receive (1 of 2 overloads)] - - -Start an asynchronous receive on a connected socket. - - - template< - typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, - typename ``[link boost_asio.reference.ReadHandler ReadHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_receive( - const MutableBufferSequence & buffers, - ReadHandler && handler); - - -This function is used to asynchronously receive data from the datagram socket. The function call always returns immediately. - - -[heading Parameters] - - -[variablelist - -[[buffers][One or more buffers into which the data will be received. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]] - -[[handler][The handler to be called when the receive operation completes. Copies will be made of the handler as required. The function signature of the handler must be: -`` - void handler( - const boost::system::error_code& error, // Result of operation. - std::size_t bytes_transferred // Number of bytes received. - ); -`` -Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_context::post()`.]] - -] - - -[heading Remarks] - -The async\_receive operation can only be used with a connected socket. Use the async\_receive\_from function to receive data on an unconnected datagram socket. - - -[heading Example] - -To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: - - socket.async_receive(boost::asio::buffer(data, size), handler); - - -See the [link boost_asio.reference.buffer `buffer`] documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. - - - - -[endsect] - - - -[section:overload2 basic_datagram_socket::async_receive (2 of 2 overloads)] - - -Start an asynchronous receive on a connected socket. - - - template< - typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, - typename ``[link boost_asio.reference.ReadHandler ReadHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_receive( - const MutableBufferSequence & buffers, - socket_base::message_flags flags, - ReadHandler && handler); - - -This function is used to asynchronously receive data from the datagram socket. The function call always returns immediately. - - -[heading Parameters] - - -[variablelist - -[[buffers][One or more buffers into which the data will be received. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]] - -[[flags][Flags specifying how the receive call is to be made.]] - -[[handler][The handler to be called when the receive operation completes. Copies will be made of the handler as required. The function signature of the handler must be: -`` - void handler( - const boost::system::error_code& error, // Result of operation. - std::size_t bytes_transferred // Number of bytes received. - ); -`` -Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_context::post()`.]] - -] - - -[heading Remarks] - -The async\_receive operation can only be used with a connected socket. Use the async\_receive\_from function to receive data on an unconnected datagram socket. - - - - -[endsect] - - -[endsect] - -[section:async_receive_from basic_datagram_socket::async_receive_from] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.async_receive_from..async_receive_from..basic_datagram_socket] -Start an asynchronous receive. - - - template< - typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, - typename ``[link boost_asio.reference.ReadHandler ReadHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.basic_datagram_socket.async_receive_from.overload1 async_receive_from]``( - const MutableBufferSequence & buffers, - endpoint_type & sender_endpoint, - ReadHandler && handler); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.async_receive_from.overload1 more...]]`` - - template< - typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, - typename ``[link boost_asio.reference.ReadHandler ReadHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.basic_datagram_socket.async_receive_from.overload2 async_receive_from]``( - const MutableBufferSequence & buffers, - endpoint_type & sender_endpoint, - socket_base::message_flags flags, - ReadHandler && handler); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.async_receive_from.overload2 more...]]`` - - -[section:overload1 basic_datagram_socket::async_receive_from (1 of 2 overloads)] - - -Start an asynchronous receive. - - - template< - typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, - typename ``[link boost_asio.reference.ReadHandler ReadHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_receive_from( - const MutableBufferSequence & buffers, - endpoint_type & sender_endpoint, - ReadHandler && handler); - - -This function is used to asynchronously receive a datagram. The function call always returns immediately. - - -[heading Parameters] - - -[variablelist - -[[buffers][One or more buffers into which the data will be received. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]] - -[[sender_endpoint][An endpoint object that receives the endpoint of the remote sender of the datagram. Ownership of the sender\_endpoint object is retained by the caller, which must guarantee that it is valid until the handler is called.]] - -[[handler][The handler to be called when the receive operation completes. Copies will be made of the handler as required. The function signature of the handler must be: -`` - void handler( - const boost::system::error_code& error, // Result of operation. - std::size_t bytes_transferred // Number of bytes received. - ); -`` -Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_context::post()`.]] - -] - - -[heading Example] - -To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: - - socket.async_receive_from( - boost::asio::buffer(data, size), sender_endpoint, handler); - - -See the [link boost_asio.reference.buffer `buffer`] documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. - - - - -[endsect] - - - -[section:overload2 basic_datagram_socket::async_receive_from (2 of 2 overloads)] - - -Start an asynchronous receive. - - - template< - typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``, - typename ``[link boost_asio.reference.ReadHandler ReadHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_receive_from( - const MutableBufferSequence & buffers, - endpoint_type & sender_endpoint, - socket_base::message_flags flags, - ReadHandler && handler); - - -This function is used to asynchronously receive a datagram. The function call always returns immediately. - - -[heading Parameters] - - -[variablelist - -[[buffers][One or more buffers into which the data will be received. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]] - -[[sender_endpoint][An endpoint object that receives the endpoint of the remote sender of the datagram. Ownership of the sender\_endpoint object is retained by the caller, which must guarantee that it is valid until the handler is called.]] - -[[flags][Flags specifying how the receive call is to be made.]] - -[[handler][The handler to be called when the receive operation completes. Copies will be made of the handler as required. The function signature of the handler must be: -`` - void handler( - const boost::system::error_code& error, // Result of operation. - std::size_t bytes_transferred // Number of bytes received. - ); -`` -Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_context::post()`. ]] - -] - - - - -[endsect] - - -[endsect] - -[section:async_send basic_datagram_socket::async_send] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.async_send..async_send..basic_datagram_socket] -Start an asynchronous send on a connected socket. - - - template< - typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, - typename ``[link boost_asio.reference.WriteHandler WriteHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.basic_datagram_socket.async_send.overload1 async_send]``( - const ConstBufferSequence & buffers, - WriteHandler && handler); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.async_send.overload1 more...]]`` - - template< - typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, - typename ``[link boost_asio.reference.WriteHandler WriteHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.basic_datagram_socket.async_send.overload2 async_send]``( - const ConstBufferSequence & buffers, - socket_base::message_flags flags, - WriteHandler && handler); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.async_send.overload2 more...]]`` - - -[section:overload1 basic_datagram_socket::async_send (1 of 2 overloads)] - - -Start an asynchronous send on a connected socket. - - - template< - typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, - typename ``[link boost_asio.reference.WriteHandler WriteHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_send( - const ConstBufferSequence & buffers, - WriteHandler && handler); - - -This function is used to asynchronously send data on the datagram socket. The function call always returns immediately. - - -[heading Parameters] - - -[variablelist - -[[buffers][One or more data buffers to be sent on the socket. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]] - -[[handler][The handler to be called when the send operation completes. Copies will be made of the handler as required. The function signature of the handler must be: -`` - void handler( - const boost::system::error_code& error, // Result of operation. - std::size_t bytes_transferred // Number of bytes sent. - ); -`` -Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_context::post()`.]] - -] - - -[heading Remarks] - -The async\_send operation can only be used with a connected socket. Use the async\_send\_to function to send data on an unconnected datagram socket. - - -[heading Example] - -To send a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: - - socket.async_send(boost::asio::buffer(data, size), handler); - - -See the [link boost_asio.reference.buffer `buffer`] documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. - - - - -[endsect] - - - -[section:overload2 basic_datagram_socket::async_send (2 of 2 overloads)] - - -Start an asynchronous send on a connected socket. - - - template< - typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, - typename ``[link boost_asio.reference.WriteHandler WriteHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_send( - const ConstBufferSequence & buffers, - socket_base::message_flags flags, - WriteHandler && handler); - - -This function is used to asynchronously send data on the datagram socket. The function call always returns immediately. - - -[heading Parameters] - - -[variablelist - -[[buffers][One or more data buffers to be sent on the socket. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]] - -[[flags][Flags specifying how the send call is to be made.]] - -[[handler][The handler to be called when the send operation completes. Copies will be made of the handler as required. The function signature of the handler must be: -`` - void handler( - const boost::system::error_code& error, // Result of operation. - std::size_t bytes_transferred // Number of bytes sent. - ); -`` -Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_context::post()`.]] - -] - - -[heading Remarks] - -The async\_send operation can only be used with a connected socket. Use the async\_send\_to function to send data on an unconnected datagram socket. - - - - -[endsect] - - -[endsect] - -[section:async_send_to basic_datagram_socket::async_send_to] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.async_send_to..async_send_to..basic_datagram_socket] -Start an asynchronous send. - - - template< - typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, - typename ``[link boost_asio.reference.WriteHandler WriteHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.basic_datagram_socket.async_send_to.overload1 async_send_to]``( - const ConstBufferSequence & buffers, - const endpoint_type & destination, - WriteHandler && handler); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.async_send_to.overload1 more...]]`` - - template< - typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, - typename ``[link boost_asio.reference.WriteHandler WriteHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` ``[link boost_asio.reference.basic_datagram_socket.async_send_to.overload2 async_send_to]``( - const ConstBufferSequence & buffers, - const endpoint_type & destination, - socket_base::message_flags flags, - WriteHandler && handler); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.async_send_to.overload2 more...]]`` - - -[section:overload1 basic_datagram_socket::async_send_to (1 of 2 overloads)] - - -Start an asynchronous send. - - - template< - typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, - typename ``[link boost_asio.reference.WriteHandler WriteHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_send_to( - const ConstBufferSequence & buffers, - const endpoint_type & destination, - WriteHandler && handler); - - -This function is used to asynchronously send a datagram to the specified remote endpoint. The function call always returns immediately. - - -[heading Parameters] - - -[variablelist - -[[buffers][One or more data buffers to be sent to the remote endpoint. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]] - -[[destination][The remote endpoint to which the data will be sent. Copies will be made of the endpoint as required.]] - -[[handler][The handler to be called when the send operation completes. Copies will be made of the handler as required. The function signature of the handler must be: -`` - void handler( - const boost::system::error_code& error, // Result of operation. - std::size_t bytes_transferred // Number of bytes sent. - ); -`` -Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_context::post()`.]] - -] - - -[heading Example] - -To send a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: - - boost::asio::ip::udp::endpoint destination( - boost::asio::ip::address::from_string("1.2.3.4"), 12345); - socket.async_send_to( - boost::asio::buffer(data, size), destination, handler); - - -See the [link boost_asio.reference.buffer `buffer`] documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. - - - - -[endsect] - - - -[section:overload2 basic_datagram_socket::async_send_to (2 of 2 overloads)] - - -Start an asynchronous send. - - - template< - typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``, - typename ``[link boost_asio.reference.WriteHandler WriteHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_send_to( - const ConstBufferSequence & buffers, - const endpoint_type & destination, - socket_base::message_flags flags, - WriteHandler && handler); - - -This function is used to asynchronously send a datagram to the specified remote endpoint. The function call always returns immediately. - - -[heading Parameters] - - -[variablelist - -[[buffers][One or more data buffers to be sent to the remote endpoint. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]] - -[[flags][Flags specifying how the send call is to be made.]] - -[[destination][The remote endpoint to which the data will be sent. Copies will be made of the endpoint as required.]] - -[[handler][The handler to be called when the send operation completes. Copies will be made of the handler as required. The function signature of the handler must be: -`` - void handler( - const boost::system::error_code& error, // Result of operation. - std::size_t bytes_transferred // Number of bytes sent. - ); -`` -Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_context::post()`. ]] - -] - - - - -[endsect] - - -[endsect] - - -[section:async_wait basic_datagram_socket::async_wait] - - -['Inherited from basic_socket.] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.async_wait..async_wait..basic_datagram_socket] -Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. - - - template< - typename ``[link boost_asio.reference.WaitHandler WaitHandler]``> - ``[link boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type ['DEDUCED]]`` async_wait( - wait_type w, - WaitHandler && handler); - - -This function is used to perform an asynchronous wait for a socket to enter a ready to read, write or error condition state. - - -[heading Parameters] - - -[variablelist - -[[w][Specifies the desired socket state.]] - -[[handler][The handler to be called when the wait operation completes. Copies will be made of the handler as required. The function signature of the handler must be: -`` - void handler( - const boost::system::error_code& error // Result of operation - ); -`` -Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_context::post()`.]] - -] - - -[heading Example] - - - - void wait_handler(const boost::system::error_code& error) - { - if (!error) - { - // Wait succeeded. - } - } - - ... - - boost::asio::ip::tcp::socket socket(io_context); - ... - socket.async_wait(boost::asio::ip::tcp::socket::wait_read, wait_handler); - - - - - - - -[endsect] - - -[section:at_mark basic_datagram_socket::at_mark] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.at_mark..at_mark..basic_datagram_socket] -Determine whether the socket is at the out-of-band data mark. - - - bool ``[link boost_asio.reference.basic_datagram_socket.at_mark.overload1 at_mark]``() const; - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.at_mark.overload1 more...]]`` - - bool ``[link boost_asio.reference.basic_datagram_socket.at_mark.overload2 at_mark]``( - boost::system::error_code & ec) const; - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.at_mark.overload2 more...]]`` - - -[section:overload1 basic_datagram_socket::at_mark (1 of 2 overloads)] - - -['Inherited from basic_socket.] - - -Determine whether the socket is at the out-of-band data mark. - - - bool at_mark() const; - - -This function is used to check whether the socket input is currently positioned at the out-of-band data mark. - - -[heading Return Value] - -A bool indicating whether the socket is at the out-of-band data mark. - - -[heading Exceptions] - - -[variablelist - -[[boost::system::system_error][Thrown on failure. ]] - -] - - - - -[endsect] - - - -[section:overload2 basic_datagram_socket::at_mark (2 of 2 overloads)] - - -['Inherited from basic_socket.] - - -Determine whether the socket is at the out-of-band data mark. - - - bool at_mark( - boost::system::error_code & ec) const; - - -This function is used to check whether the socket input is currently positioned at the out-of-band data mark. - - -[heading Parameters] - - -[variablelist - -[[ec][Set to indicate what error occurred, if any.]] - -] - - -[heading Return Value] - -A bool indicating whether the socket is at the out-of-band data mark. - - - - -[endsect] - - -[endsect] - -[section:available basic_datagram_socket::available] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.available..available..basic_datagram_socket] -Determine the number of bytes available for reading. - - - std::size_t ``[link boost_asio.reference.basic_datagram_socket.available.overload1 available]``() const; - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.available.overload1 more...]]`` - - std::size_t ``[link boost_asio.reference.basic_datagram_socket.available.overload2 available]``( - boost::system::error_code & ec) const; - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.available.overload2 more...]]`` - - -[section:overload1 basic_datagram_socket::available (1 of 2 overloads)] - - -['Inherited from basic_socket.] - - -Determine the number of bytes available for reading. - - - std::size_t available() const; - - -This function is used to determine the number of bytes that may be read without blocking. - - -[heading Return Value] - -The number of bytes that may be read without blocking, or 0 if an error occurs. - - -[heading Exceptions] - - -[variablelist - -[[boost::system::system_error][Thrown on failure. ]] - -] - - - - -[endsect] - - - -[section:overload2 basic_datagram_socket::available (2 of 2 overloads)] - - -['Inherited from basic_socket.] - - -Determine the number of bytes available for reading. - - - std::size_t available( - boost::system::error_code & ec) const; - - -This function is used to determine the number of bytes that may be read without blocking. - - -[heading Parameters] - - -[variablelist - -[[ec][Set to indicate what error occurred, if any.]] - -] - - -[heading Return Value] - -The number of bytes that may be read without blocking, or 0 if an error occurs. - - - - -[endsect] - - -[endsect] - -[section:basic_datagram_socket basic_datagram_socket::basic_datagram_socket] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.basic_datagram_socket..basic_datagram_socket..basic_datagram_socket] -Construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] without opening it. - - - explicit ``[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload1 basic_datagram_socket]``( - boost::asio::io_context & io_context); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload1 more...]]`` - - -Construct and open a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`]. - - - ``[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload2 basic_datagram_socket]``( - boost::asio::io_context & io_context, - const protocol_type & protocol); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload2 more...]]`` - - -Construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`], opening it and binding it to the given local endpoint. - - - ``[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload3 basic_datagram_socket]``( - boost::asio::io_context & io_context, - const endpoint_type & endpoint); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload3 more...]]`` - - -Construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] on an existing native socket. - - - ``[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload4 basic_datagram_socket]``( - boost::asio::io_context & io_context, - const protocol_type & protocol, - const native_handle_type & native_socket); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload4 more...]]`` - - -Move-construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] from another. - - - ``[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload5 basic_datagram_socket]``( - basic_datagram_socket && other); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload5 more...]]`` - - -Move-construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] from a socket of another protocol type. - - - template< - typename ``[link boost_asio.reference.Protocol Protocol1]``> - ``[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload6 basic_datagram_socket]``( - basic_datagram_socket< Protocol1 > && other, - typename enable_if< is_convertible< Protocol1, Protocol >::value >::type * = 0); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload6 more...]]`` - - -[section:overload1 basic_datagram_socket::basic_datagram_socket (1 of 6 overloads)] - - -Construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] without opening it. - - - basic_datagram_socket( - boost::asio::io_context & io_context); - - -This constructor creates a datagram socket without opening it. The `open()` function must be called before data can be sent or received on the socket. - - -[heading Parameters] - - -[variablelist - -[[io_context][The [link boost_asio.reference.io_context `io_context`] object that the datagram socket will use to dispatch handlers for any asynchronous operations performed on the socket. ]] - -] - - - - -[endsect] - - - -[section:overload2 basic_datagram_socket::basic_datagram_socket (2 of 6 overloads)] - - -Construct and open a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`]. - - - basic_datagram_socket( - boost::asio::io_context & io_context, - const protocol_type & protocol); - - -This constructor creates and opens a datagram socket. - - -[heading Parameters] - - -[variablelist - -[[io_context][The [link boost_asio.reference.io_context `io_context`] object that the datagram socket will use to dispatch handlers for any asynchronous operations performed on the socket.]] - -[[protocol][An object specifying protocol parameters to be used.]] - -] - - -[heading Exceptions] - - -[variablelist - -[[boost::system::system_error][Thrown on failure. ]] - -] - - - - -[endsect] - - - -[section:overload3 basic_datagram_socket::basic_datagram_socket (3 of 6 overloads)] - - -Construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`], opening it and binding it to the given local endpoint. - - - basic_datagram_socket( - boost::asio::io_context & io_context, - const endpoint_type & endpoint); - - -This constructor creates a datagram socket and automatically opens it bound to the specified endpoint on the local machine. The protocol used is the protocol associated with the given endpoint. - - -[heading Parameters] - - -[variablelist - -[[io_context][The [link boost_asio.reference.io_context `io_context`] object that the datagram socket will use to dispatch handlers for any asynchronous operations performed on the socket.]] - -[[endpoint][An endpoint on the local machine to which the datagram socket will be bound.]] - -] - - -[heading Exceptions] - - -[variablelist - -[[boost::system::system_error][Thrown on failure. ]] - -] - - - - -[endsect] - - - -[section:overload4 basic_datagram_socket::basic_datagram_socket (4 of 6 overloads)] - - -Construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] on an existing native socket. - - - basic_datagram_socket( - boost::asio::io_context & io_context, - const protocol_type & protocol, - const native_handle_type & native_socket); - - -This constructor creates a datagram socket object to hold an existing native socket. - - -[heading Parameters] - - -[variablelist - -[[io_context][The [link boost_asio.reference.io_context `io_context`] object that the datagram socket will use to dispatch handlers for any asynchronous operations performed on the socket.]] - -[[protocol][An object specifying protocol parameters to be used.]] - -[[native_socket][The new underlying socket implementation.]] - -] - - -[heading Exceptions] - - -[variablelist - -[[boost::system::system_error][Thrown on failure. ]] - -] - - - - -[endsect] - - - -[section:overload5 basic_datagram_socket::basic_datagram_socket (5 of 6 overloads)] - - -Move-construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] from another. - - - basic_datagram_socket( - basic_datagram_socket && other); - - -This constructor moves a datagram socket from one object to another. - - -[heading Parameters] - - -[variablelist - -[[other][The other [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] object from which the move will occur.]] - -] - - -[heading Remarks] - -Following the move, the moved-from object is in the same state as if constructed using the `basic_datagram_socket(io_context&) constructor`. - - - - -[endsect] - - - -[section:overload6 basic_datagram_socket::basic_datagram_socket (6 of 6 overloads)] - - -Move-construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] from a socket of another protocol type. - - - template< - typename ``[link boost_asio.reference.Protocol Protocol1]``> - basic_datagram_socket( - basic_datagram_socket< Protocol1 > && other, - typename enable_if< is_convertible< Protocol1, Protocol >::value >::type * = 0); - - -This constructor moves a datagram socket from one object to another. - - -[heading Parameters] - - -[variablelist - -[[other][The other [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] object from which the move will occur.]] - -] - - -[heading Remarks] - -Following the move, the moved-from object is in the same state as if constructed using the `basic_datagram_socket(io_context&) constructor`. - - - - -[endsect] - - -[endsect] - -[section:bind basic_datagram_socket::bind] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.bind..bind..basic_datagram_socket] -Bind the socket to the given local endpoint. - - - void ``[link boost_asio.reference.basic_datagram_socket.bind.overload1 bind]``( - const endpoint_type & endpoint); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.bind.overload1 more...]]`` - - void ``[link boost_asio.reference.basic_datagram_socket.bind.overload2 bind]``( - const endpoint_type & endpoint, - boost::system::error_code & ec); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.bind.overload2 more...]]`` - - -[section:overload1 basic_datagram_socket::bind (1 of 2 overloads)] - - -['Inherited from basic_socket.] - - -Bind the socket to the given local endpoint. - - - void bind( - const endpoint_type & endpoint); - - -This function binds the socket to the specified endpoint on the local machine. - - -[heading Parameters] - - -[variablelist - -[[endpoint][An endpoint on the local machine to which the socket will be bound.]] - -] - - -[heading Exceptions] - - -[variablelist - -[[boost::system::system_error][Thrown on failure.]] - -] - - -[heading Example] - - - - boost::asio::ip::tcp::socket socket(io_context); - socket.open(boost::asio::ip::tcp::v4()); - socket.bind(boost::asio::ip::tcp::endpoint( - boost::asio::ip::tcp::v4(), 12345)); - - - - - - - -[endsect] - - - -[section:overload2 basic_datagram_socket::bind (2 of 2 overloads)] - - -['Inherited from basic_socket.] - - -Bind the socket to the given local endpoint. - - - void bind( - const endpoint_type & endpoint, - boost::system::error_code & ec); - - -This function binds the socket to the specified endpoint on the local machine. - - -[heading Parameters] - - -[variablelist - -[[endpoint][An endpoint on the local machine to which the socket will be bound.]] - -[[ec][Set to indicate what error occurred, if any.]] - -] - - -[heading Example] - - - - boost::asio::ip::tcp::socket socket(io_context); - socket.open(boost::asio::ip::tcp::v4()); - boost::system::error_code ec; - socket.bind(boost::asio::ip::tcp::endpoint( - boost::asio::ip::tcp::v4(), 12345), ec); - if (ec) - { - // An error occurred. - } - - - - - - - -[endsect] - - -[endsect] - - -[section:broadcast basic_datagram_socket::broadcast] - - -['Inherited from socket_base.] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.broadcast..broadcast..basic_datagram_socket] -Socket option to permit sending of broadcast messages. - - - typedef implementation_defined broadcast; - - - -Implements the SOL\_SOCKET/SO\_BROADCAST socket option. - - -[heading Examples] - -Setting the option: - - boost::asio::ip::udp::socket socket(io_context); - ... - boost::asio::socket_base::broadcast option(true); - socket.set_option(option); - - - - - -Getting the current option value: - - boost::asio::ip::udp::socket socket(io_context); - ... - boost::asio::socket_base::broadcast option; - socket.get_option(option); - bool is_set = option.value(); - - - - - - - -[heading Requirements] - -['Header: ][^boost/asio/basic_datagram_socket.hpp] - -['Convenience header: ][^boost/asio.hpp] - - -[endsect] - - - -[section:bytes_readable basic_datagram_socket::bytes_readable] - - -['Inherited from socket_base.] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.bytes_readable..bytes_readable..basic_datagram_socket] -IO control command to get the amount of data that can be read without blocking. - - - typedef implementation_defined bytes_readable; - - - -Implements the FIONREAD IO control command. - - -[heading Example] - - - - boost::asio::ip::tcp::socket socket(io_context); - ... - boost::asio::socket_base::bytes_readable command(true); - socket.io_control(command); - std::size_t bytes_readable = command.get(); - - - - - - - -[heading Requirements] - -['Header: ][^boost/asio/basic_datagram_socket.hpp] - -['Convenience header: ][^boost/asio.hpp] - - -[endsect] - - -[section:cancel basic_datagram_socket::cancel] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.cancel..cancel..basic_datagram_socket] -Cancel all asynchronous operations associated with the socket. - - - void ``[link boost_asio.reference.basic_datagram_socket.cancel.overload1 cancel]``(); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.cancel.overload1 more...]]`` - - void ``[link boost_asio.reference.basic_datagram_socket.cancel.overload2 cancel]``( - boost::system::error_code & ec); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.cancel.overload2 more...]]`` - - -[section:overload1 basic_datagram_socket::cancel (1 of 2 overloads)] - - -['Inherited from basic_socket.] - - -Cancel all asynchronous operations associated with the socket. - - - void cancel(); - - -This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error. - - -[heading Exceptions] - - -[variablelist - -[[boost::system::system_error][Thrown on failure.]] - -] - - -[heading Remarks] - -Calls to `cancel()` will always fail with `boost::asio::error::operation_not_supported` when run on Windows XP, Windows Server 2003, and earlier versions of Windows, unless BOOST\_ASIO\_ENABLE\_CANCELIO is defined. However, the CancelIo function has two issues that should be considered before enabling its use: - - -* It will only cancel asynchronous operations that were initiated in the current thread. - - -* It can appear to complete without error, but the request to cancel the unfinished operations may be silently ignored by the operating system. Whether it works or not seems to depend on the drivers that are installed. - -For portable cancellation, consider using one of the following alternatives: - - -* Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP. - - -* Use the `close()` function to simultaneously cancel the outstanding operations and close the socket. - -When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above. - - -[endsect] - - - -[section:overload2 basic_datagram_socket::cancel (2 of 2 overloads)] - - -['Inherited from basic_socket.] - - -Cancel all asynchronous operations associated with the socket. - - - void cancel( - boost::system::error_code & ec); - - -This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error. - - -[heading Parameters] - - -[variablelist - -[[ec][Set to indicate what error occurred, if any.]] - -] - - -[heading Remarks] - -Calls to `cancel()` will always fail with `boost::asio::error::operation_not_supported` when run on Windows XP, Windows Server 2003, and earlier versions of Windows, unless BOOST\_ASIO\_ENABLE\_CANCELIO is defined. However, the CancelIo function has two issues that should be considered before enabling its use: - - -* It will only cancel asynchronous operations that were initiated in the current thread. - - -* It can appear to complete without error, but the request to cancel the unfinished operations may be silently ignored by the operating system. Whether it works or not seems to depend on the drivers that are installed. - -For portable cancellation, consider using one of the following alternatives: - - -* Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP. - - -* Use the `close()` function to simultaneously cancel the outstanding operations and close the socket. - -When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above. - - -[endsect] - - -[endsect] - -[section:close basic_datagram_socket::close] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.close..close..basic_datagram_socket] -Close the socket. - - - void ``[link boost_asio.reference.basic_datagram_socket.close.overload1 close]``(); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.close.overload1 more...]]`` - - void ``[link boost_asio.reference.basic_datagram_socket.close.overload2 close]``( - boost::system::error_code & ec); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.close.overload2 more...]]`` - - -[section:overload1 basic_datagram_socket::close (1 of 2 overloads)] - - -['Inherited from basic_socket.] - - -Close the socket. - - - void close(); - - -This function is used to close the socket. Any asynchronous send, receive or connect operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error. - - -[heading Exceptions] - - -[variablelist - -[[boost::system::system_error][Thrown on failure. Note that, even if the function indicates an error, the underlying descriptor is closed.]] - -] - - -[heading Remarks] - -For portable behaviour with respect to graceful closure of a connected socket, call `shutdown()` before closing the socket. - - - - -[endsect] - - - -[section:overload2 basic_datagram_socket::close (2 of 2 overloads)] - - -['Inherited from basic_socket.] - - -Close the socket. - - - void close( - boost::system::error_code & ec); - - -This function is used to close the socket. Any asynchronous send, receive or connect operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error. - - -[heading Parameters] - - -[variablelist - -[[ec][Set to indicate what error occurred, if any. Note that, even if the function indicates an error, the underlying descriptor is closed.]] - -] - - -[heading Example] - - - - boost::asio::ip::tcp::socket socket(io_context); - ... - boost::system::error_code ec; - socket.close(ec); - if (ec) - { - // An error occurred. - } - - - - - -[heading Remarks] - -For portable behaviour with respect to graceful closure of a connected socket, call `shutdown()` before closing the socket. - - - - -[endsect] - - -[endsect] - -[section:connect basic_datagram_socket::connect] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.connect..connect..basic_datagram_socket] -Connect the socket to the specified endpoint. - - - void ``[link boost_asio.reference.basic_datagram_socket.connect.overload1 connect]``( - const endpoint_type & peer_endpoint); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.connect.overload1 more...]]`` - - void ``[link boost_asio.reference.basic_datagram_socket.connect.overload2 connect]``( - const endpoint_type & peer_endpoint, - boost::system::error_code & ec); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.connect.overload2 more...]]`` - - -[section:overload1 basic_datagram_socket::connect (1 of 2 overloads)] - - -['Inherited from basic_socket.] - - -Connect the socket to the specified endpoint. - - - void connect( - const endpoint_type & peer_endpoint); - - -This function is used to connect a socket to the specified remote endpoint. The function call will block until the connection is successfully made or an error occurs. - -The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state. - - -[heading Parameters] - - -[variablelist - -[[peer_endpoint][The remote endpoint to which the socket will be connected.]] - -] - - -[heading Exceptions] - - -[variablelist - -[[boost::system::system_error][Thrown on failure.]] - -] - - -[heading Example] - - - - boost::asio::ip::tcp::socket socket(io_context); - boost::asio::ip::tcp::endpoint endpoint( - boost::asio::ip::address::from_string("1.2.3.4"), 12345); - socket.connect(endpoint); - - - - - - - -[endsect] - - - -[section:overload2 basic_datagram_socket::connect (2 of 2 overloads)] - - -['Inherited from basic_socket.] - - -Connect the socket to the specified endpoint. - - - void connect( - const endpoint_type & peer_endpoint, - boost::system::error_code & ec); - - -This function is used to connect a socket to the specified remote endpoint. The function call will block until the connection is successfully made or an error occurs. - -The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state. - - -[heading Parameters] - - -[variablelist - -[[peer_endpoint][The remote endpoint to which the socket will be connected.]] - -[[ec][Set to indicate what error occurred, if any.]] - -] - - -[heading Example] - - - - boost::asio::ip::tcp::socket socket(io_context); - boost::asio::ip::tcp::endpoint endpoint( - boost::asio::ip::address::from_string("1.2.3.4"), 12345); - boost::system::error_code ec; - socket.connect(endpoint, ec); - if (ec) - { - // An error occurred. - } - - - - - - - -[endsect] - - -[endsect] - - -[section:debug basic_datagram_socket::debug] - - -['Inherited from socket_base.] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.debug..debug..basic_datagram_socket] -Socket option to enable socket-level debugging. - - - typedef implementation_defined debug; - - - -Implements the SOL\_SOCKET/SO\_DEBUG socket option. - - -[heading Examples] - -Setting the option: - - boost::asio::ip::tcp::socket socket(io_context); - ... - boost::asio::socket_base::debug option(true); - socket.set_option(option); - - - - - -Getting the current option value: - - boost::asio::ip::tcp::socket socket(io_context); - ... - boost::asio::socket_base::debug option; - socket.get_option(option); - bool is_set = option.value(); - - - - - - - -[heading Requirements] - -['Header: ][^boost/asio/basic_datagram_socket.hpp] - -['Convenience header: ][^boost/asio.hpp] - - -[endsect] - - - -[section:do_not_route basic_datagram_socket::do_not_route] - - -['Inherited from socket_base.] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.do_not_route..do_not_route..basic_datagram_socket] -Socket option to prevent routing, use local interfaces only. - - - typedef implementation_defined do_not_route; - - - -Implements the SOL\_SOCKET/SO\_DONTROUTE socket option. - - -[heading Examples] - -Setting the option: - - boost::asio::ip::udp::socket socket(io_context); - ... - boost::asio::socket_base::do_not_route option(true); - socket.set_option(option); - - - - - -Getting the current option value: - - boost::asio::ip::udp::socket socket(io_context); - ... - boost::asio::socket_base::do_not_route option; - socket.get_option(option); - bool is_set = option.value(); - - - - - - - -[heading Requirements] - -['Header: ][^boost/asio/basic_datagram_socket.hpp] - -['Convenience header: ][^boost/asio.hpp] - - -[endsect] - - - -[section:enable_connection_aborted basic_datagram_socket::enable_connection_aborted] - - -['Inherited from socket_base.] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.enable_connection_aborted..enable_connection_aborted..basic_datagram_socket] -Socket option to report aborted connections on accept. - - - typedef implementation_defined enable_connection_aborted; - - - -Implements a custom socket option that determines whether or not an accept operation is permitted to fail with `boost::asio::error::connection_aborted`. By default the option is false. - - -[heading Examples] - -Setting the option: - - boost::asio::ip::tcp::acceptor acceptor(io_context); - ... - boost::asio::socket_base::enable_connection_aborted option(true); - acceptor.set_option(option); - - - - - -Getting the current option value: - - boost::asio::ip::tcp::acceptor acceptor(io_context); - ... - boost::asio::socket_base::enable_connection_aborted option; - acceptor.get_option(option); - bool is_set = option.value(); - - - - - - - -[heading Requirements] - -['Header: ][^boost/asio/basic_datagram_socket.hpp] - -['Convenience header: ][^boost/asio.hpp] - - -[endsect] - - - -[section:endpoint_type basic_datagram_socket::endpoint_type] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.endpoint_type..endpoint_type..basic_datagram_socket] -The endpoint type. - - - typedef Protocol::endpoint endpoint_type; - - - -[heading Requirements] - -['Header: ][^boost/asio/basic_datagram_socket.hpp] - -['Convenience header: ][^boost/asio.hpp] - - -[endsect] - - - -[section:executor_type basic_datagram_socket::executor_type] - - -['Inherited from basic_socket.] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.executor_type..executor_type..basic_datagram_socket] -The type of the executor associated with the object. - - - typedef io_context::executor_type executor_type; - - -[heading Member Functions] -[table - [[Name][Description]] - - [ - [[link boost_asio.reference.io_context__executor_type.context [*context]]] - [Obtain the underlying execution context. ] - ] - - [ - [[link boost_asio.reference.io_context__executor_type.defer [*defer]]] - [Request the io_context to invoke the given function object. ] - ] - - [ - [[link boost_asio.reference.io_context__executor_type.dispatch [*dispatch]]] - [Request the io_context to invoke the given function object. ] - ] - - [ - [[link boost_asio.reference.io_context__executor_type.on_work_finished [*on_work_finished]]] - [Inform the io_context that some work is no longer outstanding. ] - ] - - [ - [[link boost_asio.reference.io_context__executor_type.on_work_started [*on_work_started]]] - [Inform the io_context that it has some outstanding work to do. ] - ] - - [ - [[link boost_asio.reference.io_context__executor_type.post [*post]]] - [Request the io_context to invoke the given function object. ] - ] - - [ - [[link boost_asio.reference.io_context__executor_type.running_in_this_thread [*running_in_this_thread]]] - [Determine whether the io_context is running in the current thread. ] - ] - -] - -[heading Friends] -[table - [[Name][Description]] - - [ - [[link boost_asio.reference.io_context__executor_type.operator_not__eq_ [*operator!=]]] - [Compare two executors for inequality. ] - ] - - [ - [[link boost_asio.reference.io_context__executor_type.operator_eq__eq_ [*operator==]]] - [Compare two executors for equality. ] - ] - -] - - -[heading Requirements] - -['Header: ][^boost/asio/basic_datagram_socket.hpp] - -['Convenience header: ][^boost/asio.hpp] - - -[endsect] - - - -[section:get_executor basic_datagram_socket::get_executor] - - -['Inherited from basic_socket.] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.get_executor..get_executor..basic_datagram_socket] -Get the executor associated with the object. - - - executor_type get_executor(); - - - -[endsect] - - - -[section:get_io_context basic_datagram_socket::get_io_context] - - -['Inherited from basic_socket.] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.get_io_context..get_io_context..basic_datagram_socket] -(Deprecated: Use `get_executor()`.) Get the [link boost_asio.reference.io_context `io_context`] associated with the object. - - - boost::asio::io_context & get_io_context(); - - -This function may be used to obtain the [link boost_asio.reference.io_context `io_context`] object that the I/O object uses to dispatch handlers for asynchronous operations. - - -[heading Return Value] - -A reference to the [link boost_asio.reference.io_context `io_context`] object that the I/O object will use to dispatch handlers. Ownership is not transferred to the caller. - - - - -[endsect] - - - -[section:get_io_service basic_datagram_socket::get_io_service] - - -['Inherited from basic_socket.] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.get_io_service..get_io_service..basic_datagram_socket] -(Deprecated: Use `get_executor()`.) Get the [link boost_asio.reference.io_context `io_context`] associated with the object. - - - boost::asio::io_context & get_io_service(); - - -This function may be used to obtain the [link boost_asio.reference.io_context `io_context`] object that the I/O object uses to dispatch handlers for asynchronous operations. - - -[heading Return Value] - -A reference to the [link boost_asio.reference.io_context `io_context`] object that the I/O object will use to dispatch handlers. Ownership is not transferred to the caller. - - - - -[endsect] - - -[section:get_option basic_datagram_socket::get_option] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.get_option..get_option..basic_datagram_socket] -Get an option from the socket. - - - template< - typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``> - void ``[link boost_asio.reference.basic_datagram_socket.get_option.overload1 get_option]``( - GettableSocketOption & option) const; - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.get_option.overload1 more...]]`` - - template< - typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``> - void ``[link boost_asio.reference.basic_datagram_socket.get_option.overload2 get_option]``( - GettableSocketOption & option, - boost::system::error_code & ec) const; - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.get_option.overload2 more...]]`` - - -[section:overload1 basic_datagram_socket::get_option (1 of 2 overloads)] - - -['Inherited from basic_socket.] - - -Get an option from the socket. - - - template< - typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``> - void get_option( - GettableSocketOption & option) const; - - -This function is used to get the current value of an option on the socket. - - -[heading Parameters] - - -[variablelist - -[[option][The option value to be obtained from the socket.]] - -] - - -[heading Exceptions] - - -[variablelist - -[[boost::system::system_error][Thrown on failure.]] - -] - - - -[heading Example] - -Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option: - - boost::asio::ip::tcp::socket socket(io_context); - ... - boost::asio::ip::tcp::socket::keep_alive option; - socket.get_option(option); - bool is_set = option.value(); - - - - - - - -[endsect] - - - -[section:overload2 basic_datagram_socket::get_option (2 of 2 overloads)] - - -['Inherited from basic_socket.] - - -Get an option from the socket. - - - template< - typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``> - void get_option( - GettableSocketOption & option, - boost::system::error_code & ec) const; - - -This function is used to get the current value of an option on the socket. - - -[heading Parameters] - - -[variablelist - -[[option][The option value to be obtained from the socket.]] - -[[ec][Set to indicate what error occurred, if any.]] - -] - - - -[heading Example] - -Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option: - - boost::asio::ip::tcp::socket socket(io_context); - ... - boost::asio::ip::tcp::socket::keep_alive option; - boost::system::error_code ec; - socket.get_option(option, ec); - if (ec) - { - // An error occurred. - } - bool is_set = option.value(); - - - - - - - -[endsect] - - -[endsect] - -[section:io_control basic_datagram_socket::io_control] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.io_control..io_control..basic_datagram_socket] -Perform an IO control command on the socket. - - - template< - typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``> - void ``[link boost_asio.reference.basic_datagram_socket.io_control.overload1 io_control]``( - IoControlCommand & command); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.io_control.overload1 more...]]`` - - template< - typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``> - void ``[link boost_asio.reference.basic_datagram_socket.io_control.overload2 io_control]``( - IoControlCommand & command, - boost::system::error_code & ec); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.io_control.overload2 more...]]`` - - -[section:overload1 basic_datagram_socket::io_control (1 of 2 overloads)] - - -['Inherited from basic_socket.] - - -Perform an IO control command on the socket. - - - template< - typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``> - void io_control( - IoControlCommand & command); - - -This function is used to execute an IO control command on the socket. - - -[heading Parameters] - - -[variablelist - -[[command][The IO control command to be performed on the socket.]] - -] - - -[heading Exceptions] - - -[variablelist - -[[boost::system::system_error][Thrown on failure.]] - -] - - - -[heading Example] - -Getting the number of bytes ready to read: - - boost::asio::ip::tcp::socket socket(io_context); - ... - boost::asio::ip::tcp::socket::bytes_readable command; - socket.io_control(command); - std::size_t bytes_readable = command.get(); - - - - - - - -[endsect] - - - -[section:overload2 basic_datagram_socket::io_control (2 of 2 overloads)] - - -['Inherited from basic_socket.] - - -Perform an IO control command on the socket. - - - template< - typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``> - void io_control( - IoControlCommand & command, - boost::system::error_code & ec); - - -This function is used to execute an IO control command on the socket. - - -[heading Parameters] - - -[variablelist - -[[command][The IO control command to be performed on the socket.]] - -[[ec][Set to indicate what error occurred, if any.]] - -] - - - -[heading Example] - -Getting the number of bytes ready to read: - - boost::asio::ip::tcp::socket socket(io_context); - ... - boost::asio::ip::tcp::socket::bytes_readable command; - boost::system::error_code ec; - socket.io_control(command, ec); - if (ec) - { - // An error occurred. - } - std::size_t bytes_readable = command.get(); - - - - - - - -[endsect] - - -[endsect] - - -[section:is_open basic_datagram_socket::is_open] - - -['Inherited from basic_socket.] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.is_open..is_open..basic_datagram_socket] -Determine whether the socket is open. - - - bool is_open() const; - - - -[endsect] - - - -[section:keep_alive basic_datagram_socket::keep_alive] - - -['Inherited from socket_base.] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.keep_alive..keep_alive..basic_datagram_socket] -Socket option to send keep-alives. - - - typedef implementation_defined keep_alive; - - - -Implements the SOL\_SOCKET/SO\_KEEPALIVE socket option. - - -[heading Examples] - -Setting the option: - - boost::asio::ip::tcp::socket socket(io_context); - ... - boost::asio::socket_base::keep_alive option(true); - socket.set_option(option); - - - - - -Getting the current option value: - - boost::asio::ip::tcp::socket socket(io_context); - ... - boost::asio::socket_base::keep_alive option; - socket.get_option(option); - bool is_set = option.value(); - - - - - - - -[heading Requirements] - -['Header: ][^boost/asio/basic_datagram_socket.hpp] - -['Convenience header: ][^boost/asio.hpp] - - -[endsect] - - - -[section:linger basic_datagram_socket::linger] - - -['Inherited from socket_base.] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.linger..linger..basic_datagram_socket] -Socket option to specify whether the socket lingers on close if unsent data is present. - - - typedef implementation_defined linger; - - - -Implements the SOL\_SOCKET/SO\_LINGER socket option. - - -[heading Examples] - -Setting the option: - - boost::asio::ip::tcp::socket socket(io_context); - ... - boost::asio::socket_base::linger option(true, 30); - socket.set_option(option); - - - - - -Getting the current option value: - - boost::asio::ip::tcp::socket socket(io_context); - ... - boost::asio::socket_base::linger option; - socket.get_option(option); - bool is_set = option.enabled(); - unsigned short timeout = option.timeout(); - - - - - - - -[heading Requirements] - -['Header: ][^boost/asio/basic_datagram_socket.hpp] - -['Convenience header: ][^boost/asio.hpp] - - -[endsect] - - -[section:local_endpoint basic_datagram_socket::local_endpoint] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.local_endpoint..local_endpoint..basic_datagram_socket] -Get the local endpoint of the socket. - - - endpoint_type ``[link boost_asio.reference.basic_datagram_socket.local_endpoint.overload1 local_endpoint]``() const; - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.local_endpoint.overload1 more...]]`` - - endpoint_type ``[link boost_asio.reference.basic_datagram_socket.local_endpoint.overload2 local_endpoint]``( - boost::system::error_code & ec) const; - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.local_endpoint.overload2 more...]]`` - - -[section:overload1 basic_datagram_socket::local_endpoint (1 of 2 overloads)] - - -['Inherited from basic_socket.] - - -Get the local endpoint of the socket. - - - endpoint_type local_endpoint() const; - - -This function is used to obtain the locally bound endpoint of the socket. - - -[heading Return Value] - -An object that represents the local endpoint of the socket. - - -[heading Exceptions] - - -[variablelist - -[[boost::system::system_error][Thrown on failure.]] - -] - - -[heading Example] - - - - boost::asio::ip::tcp::socket socket(io_context); - ... - boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint(); - - - - - - - -[endsect] - - - -[section:overload2 basic_datagram_socket::local_endpoint (2 of 2 overloads)] - - -['Inherited from basic_socket.] - - -Get the local endpoint of the socket. - - - endpoint_type local_endpoint( - boost::system::error_code & ec) const; - - -This function is used to obtain the locally bound endpoint of the socket. - - -[heading Parameters] - - -[variablelist - -[[ec][Set to indicate what error occurred, if any.]] - -] - - -[heading Return Value] - -An object that represents the local endpoint of the socket. Returns a default-constructed endpoint object if an error occurred. - - -[heading Example] - - - - boost::asio::ip::tcp::socket socket(io_context); - ... - boost::system::error_code ec; - boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint(ec); - if (ec) - { - // An error occurred. - } - - - - - - - -[endsect] - - -[endsect] - -[section:lowest_layer basic_datagram_socket::lowest_layer] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.lowest_layer..lowest_layer..basic_datagram_socket] -Get a reference to the lowest layer. - - - lowest_layer_type & ``[link boost_asio.reference.basic_datagram_socket.lowest_layer.overload1 lowest_layer]``(); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.lowest_layer.overload1 more...]]`` - - -Get a const reference to the lowest layer. - - - const lowest_layer_type & ``[link boost_asio.reference.basic_datagram_socket.lowest_layer.overload2 lowest_layer]``() const; - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.lowest_layer.overload2 more...]]`` - - -[section:overload1 basic_datagram_socket::lowest_layer (1 of 2 overloads)] - - -['Inherited from basic_socket.] - - -Get a reference to the lowest layer. - - - lowest_layer_type & lowest_layer(); - - -This function returns a reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.basic_socket `basic_socket`] cannot contain any further layers, it simply returns a reference to itself. - - -[heading Return Value] - -A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. - - - - -[endsect] - - - -[section:overload2 basic_datagram_socket::lowest_layer (2 of 2 overloads)] - - -['Inherited from basic_socket.] - - -Get a const reference to the lowest layer. - - - const lowest_layer_type & lowest_layer() const; - - -This function returns a const reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.basic_socket `basic_socket`] cannot contain any further layers, it simply returns a reference to itself. - - -[heading Return Value] - -A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller. - - - - -[endsect] - - -[endsect] - - -[section:lowest_layer_type basic_datagram_socket::lowest_layer_type] - - -['Inherited from basic_socket.] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.lowest_layer_type..lowest_layer_type..basic_datagram_socket] -A [link boost_asio.reference.basic_socket `basic_socket`] is always the lowest layer. - - - typedef basic_socket< Protocol > lowest_layer_type; - - -[heading Types] -[table - [[Name][Description]] - - [ - - [[link boost_asio.reference.basic_socket.broadcast [*broadcast]]] - [Socket option to permit sending of broadcast messages. ] - - ] - - [ - - [[link boost_asio.reference.basic_socket.bytes_readable [*bytes_readable]]] - [IO control command to get the amount of data that can be read without blocking. ] - - ] - - [ - - [[link boost_asio.reference.basic_socket.debug [*debug]]] - [Socket option to enable socket-level debugging. ] - - ] - - [ - - [[link boost_asio.reference.basic_socket.do_not_route [*do_not_route]]] - [Socket option to prevent routing, use local interfaces only. ] - - ] - - [ - - [[link boost_asio.reference.basic_socket.enable_connection_aborted [*enable_connection_aborted]]] - [Socket option to report aborted connections on accept. ] - - ] - - [ - - [[link boost_asio.reference.basic_socket.endpoint_type [*endpoint_type]]] - [The endpoint type. ] - - ] - - [ - - [[link boost_asio.reference.basic_socket.executor_type [*executor_type]]] - [The type of the executor associated with the object. ] - - ] - - [ - - [[link boost_asio.reference.basic_socket.keep_alive [*keep_alive]]] - [Socket option to send keep-alives. ] - - ] - - [ - - [[link boost_asio.reference.basic_socket.linger [*linger]]] - [Socket option to specify whether the socket lingers on close if unsent data is present. ] - - ] - - [ - - [[link boost_asio.reference.basic_socket.lowest_layer_type [*lowest_layer_type]]] - [A basic_socket is always the lowest layer. ] - - ] - - [ - - [[link boost_asio.reference.basic_socket.message_flags [*message_flags]]] - [Bitmask type for flags that can be passed to send and receive operations. ] - - ] - - [ - - [[link boost_asio.reference.basic_socket.native_handle_type [*native_handle_type]]] - [The native representation of a socket. ] - - ] - - [ - - [[link boost_asio.reference.basic_socket.out_of_band_inline [*out_of_band_inline]]] - [Socket option for putting received out-of-band data inline. ] - - ] - - [ - - [[link boost_asio.reference.basic_socket.protocol_type [*protocol_type]]] - [The protocol type. ] - - ] - - [ - - [[link boost_asio.reference.basic_socket.receive_buffer_size [*receive_buffer_size]]] - [Socket option for the receive buffer size of a socket. ] - - ] - - [ - - [[link boost_asio.reference.basic_socket.receive_low_watermark [*receive_low_watermark]]] - [Socket option for the receive low watermark. ] - - ] - - [ - - [[link boost_asio.reference.basic_socket.reuse_address [*reuse_address]]] - [Socket option to allow the socket to be bound to an address that is already in use. ] - - ] - - [ - - [[link boost_asio.reference.basic_socket.send_buffer_size [*send_buffer_size]]] - [Socket option for the send buffer size of a socket. ] - - ] - - [ - - [[link boost_asio.reference.basic_socket.send_low_watermark [*send_low_watermark]]] - [Socket option for the send low watermark. ] - - ] - - [ - - [[link boost_asio.reference.basic_socket.shutdown_type [*shutdown_type]]] - [Different ways a socket may be shutdown. ] - - ] - - [ - - [[link boost_asio.reference.basic_socket.wait_type [*wait_type]]] - [Wait types. ] - - ] - -] - -[heading Member Functions] -[table - [[Name][Description]] - - [ - [[link boost_asio.reference.basic_socket.assign [*assign]]] - [Assign an existing native socket to the socket. ] - ] - - [ - [[link boost_asio.reference.basic_socket.async_connect [*async_connect]]] - [Start an asynchronous connect. ] - ] - - [ - [[link boost_asio.reference.basic_socket.async_wait [*async_wait]]] - [Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] - ] - - [ - [[link boost_asio.reference.basic_socket.at_mark [*at_mark]]] - [Determine whether the socket is at the out-of-band data mark. ] - ] - - [ - [[link boost_asio.reference.basic_socket.available [*available]]] - [Determine the number of bytes available for reading. ] - ] - - [ - [[link boost_asio.reference.basic_socket.basic_socket [*basic_socket]]] - [Construct a basic_socket without opening it. - - Construct and open a basic_socket. - - Construct a basic_socket, opening it and binding it to the given local endpoint. - - Construct a basic_socket on an existing native socket. - - Move-construct a basic_socket from another. - - Move-construct a basic_socket from a socket of another protocol type. ] - ] - - [ - [[link boost_asio.reference.basic_socket.bind [*bind]]] - [Bind the socket to the given local endpoint. ] - ] - - [ - [[link boost_asio.reference.basic_socket.cancel [*cancel]]] - [Cancel all asynchronous operations associated with the socket. ] - ] - - [ - [[link boost_asio.reference.basic_socket.close [*close]]] - [Close the socket. ] - ] - - [ - [[link boost_asio.reference.basic_socket.connect [*connect]]] - [Connect the socket to the specified endpoint. ] - ] - - [ - [[link boost_asio.reference.basic_socket.get_executor [*get_executor]]] - [Get the executor associated with the object. ] - ] - - [ - [[link boost_asio.reference.basic_socket.get_io_context [*get_io_context]]] - [(Deprecated: Use get_executor().) Get the io_context associated with the object. ] - ] - - [ - [[link boost_asio.reference.basic_socket.get_io_service [*get_io_service]]] - [(Deprecated: Use get_executor().) Get the io_context associated with the object. ] - ] - - [ - [[link boost_asio.reference.basic_socket.get_option [*get_option]]] - [Get an option from the socket. ] - ] - - [ - [[link boost_asio.reference.basic_socket.io_control [*io_control]]] - [Perform an IO control command on the socket. ] - ] - - [ - [[link boost_asio.reference.basic_socket.is_open [*is_open]]] - [Determine whether the socket is open. ] - ] - - [ - [[link boost_asio.reference.basic_socket.local_endpoint [*local_endpoint]]] - [Get the local endpoint of the socket. ] - ] - - [ - [[link boost_asio.reference.basic_socket.lowest_layer [*lowest_layer]]] - [Get a reference to the lowest layer. - - Get a const reference to the lowest layer. ] - ] - - [ - [[link boost_asio.reference.basic_socket.native_handle [*native_handle]]] - [Get the native socket representation. ] - ] - - [ - [[link boost_asio.reference.basic_socket.native_non_blocking [*native_non_blocking]]] - [Gets the non-blocking mode of the native socket implementation. - - Sets the non-blocking mode of the native socket implementation. ] - ] - - [ - [[link boost_asio.reference.basic_socket.non_blocking [*non_blocking]]] - [Gets the non-blocking mode of the socket. - - Sets the non-blocking mode of the socket. ] - ] - - [ - [[link boost_asio.reference.basic_socket.open [*open]]] - [Open the socket using the specified protocol. ] - ] - - [ - [[link boost_asio.reference.basic_socket.operator_eq_ [*operator=]]] - [Move-assign a basic_socket from another. - - Move-assign a basic_socket from a socket of another protocol type. ] - ] - - [ - [[link boost_asio.reference.basic_socket.release [*release]]] - [Release ownership of the underlying native socket. ] - ] - - [ - [[link boost_asio.reference.basic_socket.remote_endpoint [*remote_endpoint]]] - [Get the remote endpoint of the socket. ] - ] - - [ - [[link boost_asio.reference.basic_socket.set_option [*set_option]]] - [Set an option on the socket. ] - ] - - [ - [[link boost_asio.reference.basic_socket.shutdown [*shutdown]]] - [Disable sends or receives on the socket. ] - ] - - [ - [[link boost_asio.reference.basic_socket.wait [*wait]]] - [Wait for the socket to become ready to read, ready to write, or to have pending error conditions. ] - ] - -] - -[heading Protected Member Functions] -[table - [[Name][Description]] - - [ - [[link boost_asio.reference.basic_socket._basic_socket [*~basic_socket]]] - [Protected destructor to prevent deletion through this type. ] - ] - -] - -[heading Data Members] -[table - [[Name][Description]] - - [ - [[link boost_asio.reference.basic_socket.max_connections [*max_connections]]] - [(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. ] - ] - - [ - [[link boost_asio.reference.basic_socket.max_listen_connections [*max_listen_connections]]] - [The maximum length of the queue of pending incoming connections. ] - ] - - [ - [[link boost_asio.reference.basic_socket.message_do_not_route [*message_do_not_route]]] - [Specify that the data should not be subject to routing. ] - ] - - [ - [[link boost_asio.reference.basic_socket.message_end_of_record [*message_end_of_record]]] - [Specifies that the data marks the end of a record. ] - ] - - [ - [[link boost_asio.reference.basic_socket.message_out_of_band [*message_out_of_band]]] - [Process out-of-band data. ] - ] - - [ - [[link boost_asio.reference.basic_socket.message_peek [*message_peek]]] - [Peek at incoming data without removing it from the input queue. ] - ] - -] - -The [link boost_asio.reference.basic_socket `basic_socket`] class template provides functionality that is common to both stream-oriented and datagram-oriented sockets. - - -[heading Thread Safety] - -['Distinct] ['objects:] Safe. - -['Shared] ['objects:] Unsafe. - - - - -[heading Requirements] - -['Header: ][^boost/asio/basic_datagram_socket.hpp] - -['Convenience header: ][^boost/asio.hpp] - - -[endsect] - - - -[section:max_connections basic_datagram_socket::max_connections] - - -['Inherited from socket_base.] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.max_connections..max_connections..basic_datagram_socket] -(Deprecated: Use max\_listen\_connections.) The maximum length of the queue of pending incoming connections. - - - static const int max_connections = implementation_defined; - - - -[endsect] - - - -[section:max_listen_connections basic_datagram_socket::max_listen_connections] - - -['Inherited from socket_base.] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.max_listen_connections..max_listen_connections..basic_datagram_socket] -The maximum length of the queue of pending incoming connections. - - - static const int max_listen_connections = implementation_defined; - - - -[endsect] - - - -[section:message_do_not_route basic_datagram_socket::message_do_not_route] - - -['Inherited from socket_base.] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.message_do_not_route..message_do_not_route..basic_datagram_socket] -Specify that the data should not be subject to routing. - - - static const int message_do_not_route = implementation_defined; - - - -[endsect] - - - -[section:message_end_of_record basic_datagram_socket::message_end_of_record] - - -['Inherited from socket_base.] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.message_end_of_record..message_end_of_record..basic_datagram_socket] -Specifies that the data marks the end of a record. - - - static const int message_end_of_record = implementation_defined; - - - -[endsect] - - - -[section:message_flags basic_datagram_socket::message_flags] - - -['Inherited from socket_base.] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.message_flags..message_flags..basic_datagram_socket] -Bitmask type for flags that can be passed to send and receive operations. - - - typedef int message_flags; - - - -[heading Requirements] - -['Header: ][^boost/asio/basic_datagram_socket.hpp] - -['Convenience header: ][^boost/asio.hpp] - - -[endsect] - - - -[section:message_out_of_band basic_datagram_socket::message_out_of_band] - - -['Inherited from socket_base.] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.message_out_of_band..message_out_of_band..basic_datagram_socket] -Process out-of-band data. - - - static const int message_out_of_band = implementation_defined; - - - -[endsect] - - - -[section:message_peek basic_datagram_socket::message_peek] - - -['Inherited from socket_base.] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.message_peek..message_peek..basic_datagram_socket] -Peek at incoming data without removing it from the input queue. - - - static const int message_peek = implementation_defined; - - - -[endsect] - - - -[section:native_handle basic_datagram_socket::native_handle] - - -['Inherited from basic_socket.] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.native_handle..native_handle..basic_datagram_socket] -Get the native socket representation. - - - native_handle_type native_handle(); - - -This function may be used to obtain the underlying representation of the socket. This is intended to allow access to native socket functionality that is not otherwise provided. - - -[endsect] - - - -[section:native_handle_type basic_datagram_socket::native_handle_type] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.native_handle_type..native_handle_type..basic_datagram_socket] -The native representation of a socket. - - - typedef implementation_defined native_handle_type; - - - -[heading Requirements] - -['Header: ][^boost/asio/basic_datagram_socket.hpp] - -['Convenience header: ][^boost/asio.hpp] - - -[endsect] - - -[section:native_non_blocking basic_datagram_socket::native_non_blocking] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.native_non_blocking..native_non_blocking..basic_datagram_socket] -Gets the non-blocking mode of the native socket implementation. - - - bool ``[link boost_asio.reference.basic_datagram_socket.native_non_blocking.overload1 native_non_blocking]``() const; - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.native_non_blocking.overload1 more...]]`` - - -Sets the non-blocking mode of the native socket implementation. - - - void ``[link boost_asio.reference.basic_datagram_socket.native_non_blocking.overload2 native_non_blocking]``( - bool mode); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.native_non_blocking.overload2 more...]]`` - - void ``[link boost_asio.reference.basic_datagram_socket.native_non_blocking.overload3 native_non_blocking]``( - bool mode, - boost::system::error_code & ec); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.native_non_blocking.overload3 more...]]`` - - -[section:overload1 basic_datagram_socket::native_non_blocking (1 of 3 overloads)] - - -['Inherited from basic_socket.] - - -Gets the non-blocking mode of the native socket implementation. - - - bool native_non_blocking() const; - - -This function is used to retrieve the non-blocking mode of the underlying native socket. This mode has no effect on the behaviour of the socket object's synchronous operations. - - -[heading Return Value] - -`true` if the underlying socket is in non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error). - - -[heading Remarks] - -The current non-blocking mode is cached by the socket object. Consequently, the return value may be incorrect if the non-blocking mode was set directly on the native socket. - - -[heading Example] - -This function is 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 following example illustrates how Linux's `sendfile` system call might be encapsulated: - - template - struct sendfile_op - { - tcp::socket& sock_; - int fd_; - Handler handler_; - off_t offset_; - std::size_t total_bytes_transferred_; - - // Function call operator meeting WriteHandler requirements. - // Used as the handler for the async_write_some operation. - void operator()(boost::system::error_code ec, std::size_t) - { - // Put the underlying socket into non-blocking mode. - if (!ec) - if (!sock_.native_non_blocking()) - sock_.native_non_blocking(true, ec); - - if (!ec) - { - for (;;) - { - // Try the system call. - errno = 0; - int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536); - ec = boost::system::error_code(n < 0 ? errno : 0, - boost::asio::error::get_system_category()); - total_bytes_transferred_ += ec ? 0 : n; - - // Retry operation immediately if interrupted by signal. - if (ec == boost::asio::error::interrupted) - continue; - - // Check if we need to run the operation again. - if (ec == boost::asio::error::would_block - || ec == boost::asio::error::try_again) - { - // We have to wait for the socket to become ready again. - sock_.async_wait(tcp::socket::wait_write, *this); - return; - } - - if (ec || n == 0) - { - // An error occurred, or we have reached the end of the file. - // Either way we must exit the loop so we can call the handler. - break; - } - - // Loop around to try calling sendfile again. - } - } - - // Pass result back to user's handler. - handler_(ec, total_bytes_transferred_); - } - }; - - template - void async_sendfile(tcp::socket& sock, int fd, Handler h) - { - sendfile_op op = { sock, fd, h, 0, 0 }; - sock.async_wait(tcp::socket::wait_write, op); - } - - - - - - - -[endsect] - - - -[section:overload2 basic_datagram_socket::native_non_blocking (2 of 3 overloads)] - - -['Inherited from basic_socket.] - - -Sets the non-blocking mode of the native socket implementation. - - - void native_non_blocking( - bool mode); - - -This function is used to modify the non-blocking mode of the underlying native socket. It has no effect on the behaviour of the socket object's synchronous operations. - - -[heading Parameters] - - -[variablelist - -[[mode][If `true`, the underlying socket is put into non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).]] - -] - - -[heading Exceptions] - - -[variablelist - -[[boost::system::system_error][Thrown on failure. If the `mode` is `false`, but the current value of `non_blocking()` is `true`, this function fails with `boost::asio::error::invalid_argument`, as the combination does not make sense.]] - -] - - -[heading Example] - -This function is 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 following example illustrates how Linux's `sendfile` system call might be encapsulated: - - template - struct sendfile_op - { - tcp::socket& sock_; - int fd_; - Handler handler_; - off_t offset_; - std::size_t total_bytes_transferred_; - - // Function call operator meeting WriteHandler requirements. - // Used as the handler for the async_write_some operation. - void operator()(boost::system::error_code ec, std::size_t) - { - // Put the underlying socket into non-blocking mode. - if (!ec) - if (!sock_.native_non_blocking()) - sock_.native_non_blocking(true, ec); - - if (!ec) - { - for (;;) - { - // Try the system call. - errno = 0; - int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536); - ec = boost::system::error_code(n < 0 ? errno : 0, - boost::asio::error::get_system_category()); - total_bytes_transferred_ += ec ? 0 : n; - - // Retry operation immediately if interrupted by signal. - if (ec == boost::asio::error::interrupted) - continue; - - // Check if we need to run the operation again. - if (ec == boost::asio::error::would_block - || ec == boost::asio::error::try_again) - { - // We have to wait for the socket to become ready again. - sock_.async_wait(tcp::socket::wait_write, *this); - return; - } - - if (ec || n == 0) - { - // An error occurred, or we have reached the end of the file. - // Either way we must exit the loop so we can call the handler. - break; - } - - // Loop around to try calling sendfile again. - } - } - - // Pass result back to user's handler. - handler_(ec, total_bytes_transferred_); - } - }; - - template - void async_sendfile(tcp::socket& sock, int fd, Handler h) - { - sendfile_op op = { sock, fd, h, 0, 0 }; - sock.async_wait(tcp::socket::wait_write, op); - } - - - - - - - -[endsect] - - - -[section:overload3 basic_datagram_socket::native_non_blocking (3 of 3 overloads)] - - -['Inherited from basic_socket.] - - -Sets the non-blocking mode of the native socket implementation. - - - void native_non_blocking( - bool mode, - boost::system::error_code & ec); - - -This function is used to modify the non-blocking mode of the underlying native socket. It has no effect on the behaviour of the socket object's synchronous operations. - - -[heading Parameters] - - -[variablelist - -[[mode][If `true`, the underlying socket is put into non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).]] - -[[ec][Set to indicate what error occurred, if any. If the `mode` is `false`, but the current value of `non_blocking()` is `true`, this function fails with `boost::asio::error::invalid_argument`, as the combination does not make sense.]] - -] - - -[heading Example] - -This function is 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 following example illustrates how Linux's `sendfile` system call might be encapsulated: - - template - struct sendfile_op - { - tcp::socket& sock_; - int fd_; - Handler handler_; - off_t offset_; - std::size_t total_bytes_transferred_; - - // Function call operator meeting WriteHandler requirements. - // Used as the handler for the async_write_some operation. - void operator()(boost::system::error_code ec, std::size_t) - { - // Put the underlying socket into non-blocking mode. - if (!ec) - if (!sock_.native_non_blocking()) - sock_.native_non_blocking(true, ec); - - if (!ec) - { - for (;;) - { - // Try the system call. - errno = 0; - int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536); - ec = boost::system::error_code(n < 0 ? errno : 0, - boost::asio::error::get_system_category()); - total_bytes_transferred_ += ec ? 0 : n; - - // Retry operation immediately if interrupted by signal. - if (ec == boost::asio::error::interrupted) - continue; - - // Check if we need to run the operation again. - if (ec == boost::asio::error::would_block - || ec == boost::asio::error::try_again) - { - // We have to wait for the socket to become ready again. - sock_.async_wait(tcp::socket::wait_write, *this); - return; - } - - if (ec || n == 0) - { - // An error occurred, or we have reached the end of the file. - // Either way we must exit the loop so we can call the handler. - break; - } - - // Loop around to try calling sendfile again. - } - } - - // Pass result back to user's handler. - handler_(ec, total_bytes_transferred_); - } - }; - - template - void async_sendfile(tcp::socket& sock, int fd, Handler h) - { - sendfile_op op = { sock, fd, h, 0, 0 }; - sock.async_wait(tcp::socket::wait_write, op); - } - - - - - - - -[endsect] - - -[endsect] - -[section:non_blocking basic_datagram_socket::non_blocking] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.non_blocking..non_blocking..basic_datagram_socket] -Gets the non-blocking mode of the socket. - - - bool ``[link boost_asio.reference.basic_datagram_socket.non_blocking.overload1 non_blocking]``() const; - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.non_blocking.overload1 more...]]`` - - -Sets the non-blocking mode of the socket. - - - void ``[link boost_asio.reference.basic_datagram_socket.non_blocking.overload2 non_blocking]``( - bool mode); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.non_blocking.overload2 more...]]`` - - void ``[link boost_asio.reference.basic_datagram_socket.non_blocking.overload3 non_blocking]``( - bool mode, - boost::system::error_code & ec); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.non_blocking.overload3 more...]]`` - - -[section:overload1 basic_datagram_socket::non_blocking (1 of 3 overloads)] - - -['Inherited from basic_socket.] - - -Gets the non-blocking mode of the socket. - - - bool non_blocking() const; - - - -[heading Return Value] - -`true` if the socket's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete. - - -[heading Remarks] - -The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`. - - - - -[endsect] - - - -[section:overload2 basic_datagram_socket::non_blocking (2 of 3 overloads)] - - -['Inherited from basic_socket.] - - -Sets the non-blocking mode of the socket. - - - void non_blocking( - bool mode); - - - -[heading Parameters] - - -[variablelist - -[[mode][If `true`, the socket's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.]] - -] - - -[heading Exceptions] - - -[variablelist - -[[boost::system::system_error][Thrown on failure.]] - -] - - -[heading Remarks] - -The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`. - - - - -[endsect] - - - -[section:overload3 basic_datagram_socket::non_blocking (3 of 3 overloads)] - - -['Inherited from basic_socket.] - - -Sets the non-blocking mode of the socket. - - - void non_blocking( - bool mode, - boost::system::error_code & ec); - - - -[heading Parameters] - - -[variablelist - -[[mode][If `true`, the socket's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.]] - -[[ec][Set to indicate what error occurred, if any.]] - -] - - -[heading Remarks] - -The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`. - - - - -[endsect] - - -[endsect] - -[section:open basic_datagram_socket::open] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.open..open..basic_datagram_socket] -Open the socket using the specified protocol. - - - void ``[link boost_asio.reference.basic_datagram_socket.open.overload1 open]``( - const protocol_type & protocol = protocol_type()); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.open.overload1 more...]]`` - - void ``[link boost_asio.reference.basic_datagram_socket.open.overload2 open]``( - const protocol_type & protocol, - boost::system::error_code & ec); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.open.overload2 more...]]`` - - -[section:overload1 basic_datagram_socket::open (1 of 2 overloads)] - - -['Inherited from basic_socket.] - - -Open the socket using the specified protocol. - - - void open( - const protocol_type & protocol = protocol_type()); - - -This function opens the socket so that it will use the specified protocol. - - -[heading Parameters] - - -[variablelist - -[[protocol][An object specifying protocol parameters to be used.]] - -] - - -[heading Exceptions] - - -[variablelist - -[[boost::system::system_error][Thrown on failure.]] - -] - - -[heading Example] - - - - boost::asio::ip::tcp::socket socket(io_context); - socket.open(boost::asio::ip::tcp::v4()); - - - - - - - -[endsect] - - - -[section:overload2 basic_datagram_socket::open (2 of 2 overloads)] - - -['Inherited from basic_socket.] - - -Open the socket using the specified protocol. - - - void open( - const protocol_type & protocol, - boost::system::error_code & ec); - - -This function opens the socket so that it will use the specified protocol. - - -[heading Parameters] - - -[variablelist - -[[protocol][An object specifying which protocol is to be used.]] - -[[ec][Set to indicate what error occurred, if any.]] - -] - - -[heading Example] - - - - boost::asio::ip::tcp::socket socket(io_context); - boost::system::error_code ec; - socket.open(boost::asio::ip::tcp::v4(), ec); - if (ec) - { - // An error occurred. - } - - - - - - - -[endsect] - - -[endsect] - -[section:operator_eq_ basic_datagram_socket::operator=] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.operator_eq_..operator=..basic_datagram_socket] -Move-assign a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] from another. - - - basic_datagram_socket & ``[link boost_asio.reference.basic_datagram_socket.operator_eq_.overload1 operator=]``( - basic_datagram_socket && other); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.operator_eq_.overload1 more...]]`` - - -Move-assign a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] from a socket of another protocol type. - - - template< - typename ``[link boost_asio.reference.Protocol Protocol1]``> - enable_if< is_convertible< Protocol1, Protocol >::value, basic_datagram_socket >::type & ``[link boost_asio.reference.basic_datagram_socket.operator_eq_.overload2 operator=]``( - basic_datagram_socket< Protocol1 > && other); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.operator_eq_.overload2 more...]]`` - - -[section:overload1 basic_datagram_socket::operator= (1 of 2 overloads)] - - -Move-assign a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] from another. - - - basic_datagram_socket & operator=( - basic_datagram_socket && other); - - -This assignment operator moves a datagram socket from one object to another. - - -[heading Parameters] - - -[variablelist - -[[other][The other [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] object from which the move will occur.]] - -] - - -[heading Remarks] - -Following the move, the moved-from object is in the same state as if constructed using the `basic_datagram_socket(io_context&) constructor`. - - - - -[endsect] - - - -[section:overload2 basic_datagram_socket::operator= (2 of 2 overloads)] - - -Move-assign a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] from a socket of another protocol type. - - - template< - typename ``[link boost_asio.reference.Protocol Protocol1]``> - enable_if< is_convertible< Protocol1, Protocol >::value, basic_datagram_socket >::type & operator=( - basic_datagram_socket< Protocol1 > && other); - - -This assignment operator moves a datagram socket from one object to another. - - -[heading Parameters] - - -[variablelist - -[[other][The other [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] object from which the move will occur.]] - -] - - -[heading Remarks] - -Following the move, the moved-from object is in the same state as if constructed using the `basic_datagram_socket(io_context&) constructor`. - - - - -[endsect] - - -[endsect] - - -[section:out_of_band_inline basic_datagram_socket::out_of_band_inline] - - -['Inherited from socket_base.] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.out_of_band_inline..out_of_band_inline..basic_datagram_socket] -Socket option for putting received out-of-band data inline. - - - typedef implementation_defined out_of_band_inline; - - - -Implements the SOL\_SOCKET/SO\_OOBINLINE socket option. - - -[heading Examples] - -Setting the option: - - boost::asio::ip::tcp::socket socket(io_context); - ... - boost::asio::socket_base::out_of_band_inline option(true); - socket.set_option(option); - - - - - -Getting the current option value: - - boost::asio::ip::tcp::socket socket(io_context); - ... - boost::asio::socket_base::out_of_band_inline option; - socket.get_option(option); - bool value = option.value(); - - - - - - - -[heading Requirements] - -['Header: ][^boost/asio/basic_datagram_socket.hpp] - -['Convenience header: ][^boost/asio.hpp] - - -[endsect] - - - -[section:protocol_type basic_datagram_socket::protocol_type] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.protocol_type..protocol_type..basic_datagram_socket] -The protocol type. - - - typedef Protocol protocol_type; - - - -[heading Requirements] - -['Header: ][^boost/asio/basic_datagram_socket.hpp] - -['Convenience header: ][^boost/asio.hpp] - - -[endsect] - - -[section:receive basic_datagram_socket::receive] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.receive..receive..basic_datagram_socket] -Receive some data on a connected socket. - - - template< - typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> - std::size_t ``[link boost_asio.reference.basic_datagram_socket.receive.overload1 receive]``( - const MutableBufferSequence & buffers); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.receive.overload1 more...]]`` - - template< - typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> - std::size_t ``[link boost_asio.reference.basic_datagram_socket.receive.overload2 receive]``( - const MutableBufferSequence & buffers, - socket_base::message_flags flags); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.receive.overload2 more...]]`` - - template< - typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> - std::size_t ``[link boost_asio.reference.basic_datagram_socket.receive.overload3 receive]``( - const MutableBufferSequence & buffers, - socket_base::message_flags flags, - boost::system::error_code & ec); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.receive.overload3 more...]]`` - - -[section:overload1 basic_datagram_socket::receive (1 of 3 overloads)] - - -Receive some data on a connected socket. - - - template< - typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> - std::size_t receive( - const MutableBufferSequence & buffers); - - -This function is used to receive data on the datagram socket. The function call will block until data has been received successfully or an error occurs. - - -[heading Parameters] - - -[variablelist - -[[buffers][One or more buffers into which the data will be received.]] - -] - - -[heading Return Value] - -The number of bytes received. - - -[heading Exceptions] - - -[variablelist - -[[boost::system::system_error][Thrown on failure.]] - -] - - -[heading Remarks] - -The receive operation can only be used with a connected socket. Use the receive\_from function to receive data on an unconnected datagram socket. - - -[heading Example] - -To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: - - socket.receive(boost::asio::buffer(data, size)); - - -See the [link boost_asio.reference.buffer `buffer`] documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. - - - - -[endsect] - - - -[section:overload2 basic_datagram_socket::receive (2 of 3 overloads)] - - -Receive some data on a connected socket. - - - template< - typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> - std::size_t receive( - const MutableBufferSequence & buffers, - socket_base::message_flags flags); - - -This function is used to receive data on the datagram socket. The function call will block until data has been received successfully or an error occurs. - - -[heading Parameters] - - -[variablelist - -[[buffers][One or more buffers into which the data will be received.]] - -[[flags][Flags specifying how the receive call is to be made.]] - -] - - -[heading Return Value] - -The number of bytes received. - - -[heading Exceptions] - - -[variablelist - -[[boost::system::system_error][Thrown on failure.]] - -] - - -[heading Remarks] - -The receive operation can only be used with a connected socket. Use the receive\_from function to receive data on an unconnected datagram socket. - - - - -[endsect] - - - -[section:overload3 basic_datagram_socket::receive (3 of 3 overloads)] - - -Receive some data on a connected socket. - - - template< - typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> - std::size_t receive( - const MutableBufferSequence & buffers, - socket_base::message_flags flags, - boost::system::error_code & ec); - - -This function is used to receive data on the datagram socket. The function call will block until data has been received successfully or an error occurs. - - -[heading Parameters] - - -[variablelist - -[[buffers][One or more buffers into which the data will be received.]] - -[[flags][Flags specifying how the receive call is to be made.]] - -[[ec][Set to indicate what error occurred, if any.]] - -] - - -[heading Return Value] - -The number of bytes received. - - -[heading Remarks] - -The receive operation can only be used with a connected socket. Use the receive\_from function to receive data on an unconnected datagram socket. - - - - -[endsect] - - -[endsect] - - -[section:receive_buffer_size basic_datagram_socket::receive_buffer_size] - - -['Inherited from socket_base.] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.receive_buffer_size..receive_buffer_size..basic_datagram_socket] -Socket option for the receive buffer size of a socket. - - - typedef implementation_defined receive_buffer_size; - - - -Implements the SOL\_SOCKET/SO\_RCVBUF socket option. - - -[heading Examples] - -Setting the option: - - boost::asio::ip::tcp::socket socket(io_context); - ... - boost::asio::socket_base::receive_buffer_size option(8192); - socket.set_option(option); - - - - - -Getting the current option value: - - boost::asio::ip::tcp::socket socket(io_context); - ... - boost::asio::socket_base::receive_buffer_size option; - socket.get_option(option); - int size = option.value(); - - - - - - - -[heading Requirements] - -['Header: ][^boost/asio/basic_datagram_socket.hpp] - -['Convenience header: ][^boost/asio.hpp] - - -[endsect] - - -[section:receive_from basic_datagram_socket::receive_from] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.receive_from..receive_from..basic_datagram_socket] -Receive a datagram with the endpoint of the sender. - - - template< - typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> - std::size_t ``[link boost_asio.reference.basic_datagram_socket.receive_from.overload1 receive_from]``( - const MutableBufferSequence & buffers, - endpoint_type & sender_endpoint); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.receive_from.overload1 more...]]`` - - template< - typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> - std::size_t ``[link boost_asio.reference.basic_datagram_socket.receive_from.overload2 receive_from]``( - const MutableBufferSequence & buffers, - endpoint_type & sender_endpoint, - socket_base::message_flags flags); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.receive_from.overload2 more...]]`` - - template< - typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> - std::size_t ``[link boost_asio.reference.basic_datagram_socket.receive_from.overload3 receive_from]``( - const MutableBufferSequence & buffers, - endpoint_type & sender_endpoint, - socket_base::message_flags flags, - boost::system::error_code & ec); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.receive_from.overload3 more...]]`` - - -[section:overload1 basic_datagram_socket::receive_from (1 of 3 overloads)] - - -Receive a datagram with the endpoint of the sender. - - - template< - typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> - std::size_t receive_from( - const MutableBufferSequence & buffers, - endpoint_type & sender_endpoint); - - -This function is used to receive a datagram. The function call will block until data has been received successfully or an error occurs. - - -[heading Parameters] - - -[variablelist - -[[buffers][One or more buffers into which the data will be received.]] - -[[sender_endpoint][An endpoint object that receives the endpoint of the remote sender of the datagram.]] - -] - - -[heading Return Value] - -The number of bytes received. - - -[heading Exceptions] - - -[variablelist - -[[boost::system::system_error][Thrown on failure.]] - -] - - -[heading Example] - -To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: - - boost::asio::ip::udp::endpoint sender_endpoint; - socket.receive_from( - boost::asio::buffer(data, size), sender_endpoint); - - -See the [link boost_asio.reference.buffer `buffer`] documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. - - - - -[endsect] - - - -[section:overload2 basic_datagram_socket::receive_from (2 of 3 overloads)] - - -Receive a datagram with the endpoint of the sender. - - - template< - typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> - std::size_t receive_from( - const MutableBufferSequence & buffers, - endpoint_type & sender_endpoint, - socket_base::message_flags flags); - - -This function is used to receive a datagram. The function call will block until data has been received successfully or an error occurs. - - -[heading Parameters] - - -[variablelist - -[[buffers][One or more buffers into which the data will be received.]] - -[[sender_endpoint][An endpoint object that receives the endpoint of the remote sender of the datagram.]] - -[[flags][Flags specifying how the receive call is to be made.]] - -] - - -[heading Return Value] - -The number of bytes received. - - -[heading Exceptions] - - -[variablelist - -[[boost::system::system_error][Thrown on failure. ]] - -] - - - - -[endsect] - - - -[section:overload3 basic_datagram_socket::receive_from (3 of 3 overloads)] - - -Receive a datagram with the endpoint of the sender. - - - template< - typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``> - std::size_t receive_from( - const MutableBufferSequence & buffers, - endpoint_type & sender_endpoint, - socket_base::message_flags flags, - boost::system::error_code & ec); - - -This function is used to receive a datagram. The function call will block until data has been received successfully or an error occurs. - - -[heading Parameters] - - -[variablelist - -[[buffers][One or more buffers into which the data will be received.]] - -[[sender_endpoint][An endpoint object that receives the endpoint of the remote sender of the datagram.]] - -[[flags][Flags specifying how the receive call is to be made.]] - -[[ec][Set to indicate what error occurred, if any.]] - -] - - -[heading Return Value] - -The number of bytes received. - - - - -[endsect] - - -[endsect] - - -[section:receive_low_watermark basic_datagram_socket::receive_low_watermark] - - -['Inherited from socket_base.] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.receive_low_watermark..receive_low_watermark..basic_datagram_socket] -Socket option for the receive low watermark. - - - typedef implementation_defined receive_low_watermark; - - - -Implements the SOL\_SOCKET/SO\_RCVLOWAT socket option. - - -[heading Examples] - -Setting the option: - - boost::asio::ip::tcp::socket socket(io_context); - ... - boost::asio::socket_base::receive_low_watermark option(1024); - socket.set_option(option); - - - - - -Getting the current option value: - - boost::asio::ip::tcp::socket socket(io_context); - ... - boost::asio::socket_base::receive_low_watermark option; - socket.get_option(option); - int size = option.value(); - - - - - - - -[heading Requirements] - -['Header: ][^boost/asio/basic_datagram_socket.hpp] - -['Convenience header: ][^boost/asio.hpp] - - -[endsect] - - -[section:release basic_datagram_socket::release] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.release..release..basic_datagram_socket] -Release ownership of the underlying native socket. - - - native_handle_type ``[link boost_asio.reference.basic_datagram_socket.release.overload1 release]``(); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.release.overload1 more...]]`` - - native_handle_type ``[link boost_asio.reference.basic_datagram_socket.release.overload2 release]``( - boost::system::error_code & ec); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.release.overload2 more...]]`` - - -[section:overload1 basic_datagram_socket::release (1 of 2 overloads)] - - -['Inherited from basic_socket.] - - -Release ownership of the underlying native socket. - - - native_handle_type release(); - - -This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error. Ownership of the native socket is then transferred to the caller. - - -[heading Exceptions] - - -[variablelist - -[[boost::system::system_error][Thrown on failure.]] - -] - - -[heading Remarks] - -This function is unsupported on Windows versions prior to Windows 8.1, and will fail with `boost::asio::error::operation_not_supported` on these platforms. - - - - -[endsect] - - - -[section:overload2 basic_datagram_socket::release (2 of 2 overloads)] - - -['Inherited from basic_socket.] - - -Release ownership of the underlying native socket. - - - native_handle_type release( - boost::system::error_code & ec); - - -This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error. Ownership of the native socket is then transferred to the caller. - - -[heading Parameters] - - -[variablelist - -[[ec][Set to indicate what error occurred, if any.]] - -] - - -[heading Remarks] - -This function is unsupported on Windows versions prior to Windows 8.1, and will fail with `boost::asio::error::operation_not_supported` on these platforms. - - - - -[endsect] - - -[endsect] - -[section:remote_endpoint basic_datagram_socket::remote_endpoint] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.remote_endpoint..remote_endpoint..basic_datagram_socket] -Get the remote endpoint of the socket. - - - endpoint_type ``[link boost_asio.reference.basic_datagram_socket.remote_endpoint.overload1 remote_endpoint]``() const; - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.remote_endpoint.overload1 more...]]`` - - endpoint_type ``[link boost_asio.reference.basic_datagram_socket.remote_endpoint.overload2 remote_endpoint]``( - boost::system::error_code & ec) const; - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.remote_endpoint.overload2 more...]]`` - - -[section:overload1 basic_datagram_socket::remote_endpoint (1 of 2 overloads)] - - -['Inherited from basic_socket.] - - -Get the remote endpoint of the socket. - - - endpoint_type remote_endpoint() const; - - -This function is used to obtain the remote endpoint of the socket. - - -[heading Return Value] - -An object that represents the remote endpoint of the socket. - - -[heading Exceptions] - - -[variablelist - -[[boost::system::system_error][Thrown on failure.]] - -] - - -[heading Example] - - - - boost::asio::ip::tcp::socket socket(io_context); - ... - boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint(); - - - - - - - -[endsect] - - - -[section:overload2 basic_datagram_socket::remote_endpoint (2 of 2 overloads)] - - -['Inherited from basic_socket.] - - -Get the remote endpoint of the socket. - - - endpoint_type remote_endpoint( - boost::system::error_code & ec) const; - - -This function is used to obtain the remote endpoint of the socket. - - -[heading Parameters] - - -[variablelist - -[[ec][Set to indicate what error occurred, if any.]] - -] - - -[heading Return Value] - -An object that represents the remote endpoint of the socket. Returns a default-constructed endpoint object if an error occurred. - - -[heading Example] - - - - boost::asio::ip::tcp::socket socket(io_context); - ... - boost::system::error_code ec; - boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint(ec); - if (ec) - { - // An error occurred. - } - - - - - - - -[endsect] - - -[endsect] - - -[section:reuse_address basic_datagram_socket::reuse_address] - - -['Inherited from socket_base.] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.reuse_address..reuse_address..basic_datagram_socket] -Socket option to allow the socket to be bound to an address that is already in use. - - - typedef implementation_defined reuse_address; - - - -Implements the SOL\_SOCKET/SO\_REUSEADDR socket option. - - -[heading Examples] - -Setting the option: - - boost::asio::ip::tcp::acceptor acceptor(io_context); - ... - boost::asio::socket_base::reuse_address option(true); - acceptor.set_option(option); - - - - - -Getting the current option value: - - boost::asio::ip::tcp::acceptor acceptor(io_context); - ... - boost::asio::socket_base::reuse_address option; - acceptor.get_option(option); - bool is_set = option.value(); - - - - - - - -[heading Requirements] - -['Header: ][^boost/asio/basic_datagram_socket.hpp] - -['Convenience header: ][^boost/asio.hpp] - - -[endsect] - - -[section:send basic_datagram_socket::send] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.send..send..basic_datagram_socket] -Send some data on a connected socket. - - - template< - typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> - std::size_t ``[link boost_asio.reference.basic_datagram_socket.send.overload1 send]``( - const ConstBufferSequence & buffers); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.send.overload1 more...]]`` - - template< - typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> - std::size_t ``[link boost_asio.reference.basic_datagram_socket.send.overload2 send]``( - const ConstBufferSequence & buffers, - socket_base::message_flags flags); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.send.overload2 more...]]`` - - template< - typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> - std::size_t ``[link boost_asio.reference.basic_datagram_socket.send.overload3 send]``( - const ConstBufferSequence & buffers, - socket_base::message_flags flags, - boost::system::error_code & ec); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.send.overload3 more...]]`` - - -[section:overload1 basic_datagram_socket::send (1 of 3 overloads)] - - -Send some data on a connected socket. - - - template< - typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> - std::size_t send( - const ConstBufferSequence & buffers); - - -This function is used to send data on the datagram socket. The function call will block until the data has been sent successfully or an error occurs. - - -[heading Parameters] - - -[variablelist - -[[buffers][One ore more data buffers to be sent on the socket.]] - -] - - -[heading Return Value] - -The number of bytes sent. - - -[heading Exceptions] - - -[variablelist - -[[boost::system::system_error][Thrown on failure.]] - -] - - -[heading Remarks] - -The send operation can only be used with a connected socket. Use the send\_to function to send data on an unconnected datagram socket. - - -[heading Example] - -To send a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: - - socket.send(boost::asio::buffer(data, size)); - - -See the [link boost_asio.reference.buffer `buffer`] documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. - - - - -[endsect] - - - -[section:overload2 basic_datagram_socket::send (2 of 3 overloads)] - - -Send some data on a connected socket. - - - template< - typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> - std::size_t send( - const ConstBufferSequence & buffers, - socket_base::message_flags flags); - - -This function is used to send data on the datagram socket. The function call will block until the data has been sent successfully or an error occurs. - - -[heading Parameters] - - -[variablelist - -[[buffers][One ore more data buffers to be sent on the socket.]] - -[[flags][Flags specifying how the send call is to be made.]] - -] - - -[heading Return Value] - -The number of bytes sent. - - -[heading Exceptions] - - -[variablelist - -[[boost::system::system_error][Thrown on failure.]] - -] - - -[heading Remarks] - -The send operation can only be used with a connected socket. Use the send\_to function to send data on an unconnected datagram socket. - - - - -[endsect] - - - -[section:overload3 basic_datagram_socket::send (3 of 3 overloads)] - - -Send some data on a connected socket. - - - template< - typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> - std::size_t send( - const ConstBufferSequence & buffers, - socket_base::message_flags flags, - boost::system::error_code & ec); - - -This function is used to send data on the datagram socket. The function call will block until the data has been sent successfully or an error occurs. - - -[heading Parameters] - - -[variablelist - -[[buffers][One or more data buffers to be sent on the socket.]] - -[[flags][Flags specifying how the send call is to be made.]] - -[[ec][Set to indicate what error occurred, if any.]] - -] - - -[heading Return Value] - -The number of bytes sent. - - -[heading Remarks] - -The send operation can only be used with a connected socket. Use the send\_to function to send data on an unconnected datagram socket. - - - - -[endsect] - - -[endsect] - - -[section:send_buffer_size basic_datagram_socket::send_buffer_size] - - -['Inherited from socket_base.] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.send_buffer_size..send_buffer_size..basic_datagram_socket] -Socket option for the send buffer size of a socket. - - - typedef implementation_defined send_buffer_size; - - - -Implements the SOL\_SOCKET/SO\_SNDBUF socket option. - - -[heading Examples] - -Setting the option: - - boost::asio::ip::tcp::socket socket(io_context); - ... - boost::asio::socket_base::send_buffer_size option(8192); - socket.set_option(option); - - - - - -Getting the current option value: - - boost::asio::ip::tcp::socket socket(io_context); - ... - boost::asio::socket_base::send_buffer_size option; - socket.get_option(option); - int size = option.value(); - - - - - - - -[heading Requirements] - -['Header: ][^boost/asio/basic_datagram_socket.hpp] - -['Convenience header: ][^boost/asio.hpp] - - -[endsect] - - - -[section:send_low_watermark basic_datagram_socket::send_low_watermark] - - -['Inherited from socket_base.] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.send_low_watermark..send_low_watermark..basic_datagram_socket] -Socket option for the send low watermark. - - - typedef implementation_defined send_low_watermark; - - - -Implements the SOL\_SOCKET/SO\_SNDLOWAT socket option. - - -[heading Examples] - -Setting the option: - - boost::asio::ip::tcp::socket socket(io_context); - ... - boost::asio::socket_base::send_low_watermark option(1024); - socket.set_option(option); - - - - - -Getting the current option value: - - boost::asio::ip::tcp::socket socket(io_context); - ... - boost::asio::socket_base::send_low_watermark option; - socket.get_option(option); - int size = option.value(); - - - - - - - -[heading Requirements] - -['Header: ][^boost/asio/basic_datagram_socket.hpp] - -['Convenience header: ][^boost/asio.hpp] - - -[endsect] - - -[section:send_to basic_datagram_socket::send_to] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.send_to..send_to..basic_datagram_socket] -Send a datagram to the specified endpoint. - - - template< - typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> - std::size_t ``[link boost_asio.reference.basic_datagram_socket.send_to.overload1 send_to]``( - const ConstBufferSequence & buffers, - const endpoint_type & destination); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.send_to.overload1 more...]]`` - - template< - typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> - std::size_t ``[link boost_asio.reference.basic_datagram_socket.send_to.overload2 send_to]``( - const ConstBufferSequence & buffers, - const endpoint_type & destination, - socket_base::message_flags flags); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.send_to.overload2 more...]]`` - - template< - typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> - std::size_t ``[link boost_asio.reference.basic_datagram_socket.send_to.overload3 send_to]``( - const ConstBufferSequence & buffers, - const endpoint_type & destination, - socket_base::message_flags flags, - boost::system::error_code & ec); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.send_to.overload3 more...]]`` - - -[section:overload1 basic_datagram_socket::send_to (1 of 3 overloads)] - - -Send a datagram to the specified endpoint. - - - template< - typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> - std::size_t send_to( - const ConstBufferSequence & buffers, - const endpoint_type & destination); - - -This function is used to send a datagram to the specified remote endpoint. The function call will block until the data has been sent successfully or an error occurs. - - -[heading Parameters] - - -[variablelist - -[[buffers][One or more data buffers to be sent to the remote endpoint.]] - -[[destination][The remote endpoint to which the data will be sent.]] - -] - - -[heading Return Value] - -The number of bytes sent. - - -[heading Exceptions] - - -[variablelist - -[[boost::system::system_error][Thrown on failure.]] - -] - - -[heading Example] - -To send a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows: - - boost::asio::ip::udp::endpoint destination( - boost::asio::ip::address::from_string("1.2.3.4"), 12345); - socket.send_to(boost::asio::buffer(data, size), destination); - - -See the [link boost_asio.reference.buffer `buffer`] documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector. - - - - -[endsect] - - - -[section:overload2 basic_datagram_socket::send_to (2 of 3 overloads)] - - -Send a datagram to the specified endpoint. - - - template< - typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> - std::size_t send_to( - const ConstBufferSequence & buffers, - const endpoint_type & destination, - socket_base::message_flags flags); - - -This function is used to send a datagram to the specified remote endpoint. The function call will block until the data has been sent successfully or an error occurs. - - -[heading Parameters] - - -[variablelist - -[[buffers][One or more data buffers to be sent to the remote endpoint.]] - -[[destination][The remote endpoint to which the data will be sent.]] - -[[flags][Flags specifying how the send call is to be made.]] - -] - - -[heading Return Value] - -The number of bytes sent. - - -[heading Exceptions] - - -[variablelist - -[[boost::system::system_error][Thrown on failure. ]] - -] - - - - -[endsect] - - - -[section:overload3 basic_datagram_socket::send_to (3 of 3 overloads)] - - -Send a datagram to the specified endpoint. - - - template< - typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``> - std::size_t send_to( - const ConstBufferSequence & buffers, - const endpoint_type & destination, - socket_base::message_flags flags, - boost::system::error_code & ec); - - -This function is used to send a datagram to the specified remote endpoint. The function call will block until the data has been sent successfully or an error occurs. - - -[heading Parameters] - - -[variablelist - -[[buffers][One or more data buffers to be sent to the remote endpoint.]] - -[[destination][The remote endpoint to which the data will be sent.]] - -[[flags][Flags specifying how the send call is to be made.]] - -[[ec][Set to indicate what error occurred, if any.]] - -] - - -[heading Return Value] - -The number of bytes sent. - - - - -[endsect] - - -[endsect] - -[section:set_option basic_datagram_socket::set_option] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.set_option..set_option..basic_datagram_socket] -Set an option on the socket. - - - template< - typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``> - void ``[link boost_asio.reference.basic_datagram_socket.set_option.overload1 set_option]``( - const SettableSocketOption & option); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.set_option.overload1 more...]]`` - - template< - typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``> - void ``[link boost_asio.reference.basic_datagram_socket.set_option.overload2 set_option]``( - const SettableSocketOption & option, - boost::system::error_code & ec); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.set_option.overload2 more...]]`` - - -[section:overload1 basic_datagram_socket::set_option (1 of 2 overloads)] - - -['Inherited from basic_socket.] - - -Set an option on the socket. - - - template< - typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``> - void set_option( - const SettableSocketOption & option); - - -This function is used to set an option on the socket. - - -[heading Parameters] - - -[variablelist - -[[option][The new option value to be set on the socket.]] - -] - - -[heading Exceptions] - - -[variablelist - -[[boost::system::system_error][Thrown on failure.]] - -] - - - -[heading Example] - -Setting the IPPROTO\_TCP/TCP\_NODELAY option: - - boost::asio::ip::tcp::socket socket(io_context); - ... - boost::asio::ip::tcp::no_delay option(true); - socket.set_option(option); - - - - - - - -[endsect] - - - -[section:overload2 basic_datagram_socket::set_option (2 of 2 overloads)] - - -['Inherited from basic_socket.] - - -Set an option on the socket. - - - template< - typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``> - void set_option( - const SettableSocketOption & option, - boost::system::error_code & ec); - - -This function is used to set an option on the socket. - - -[heading Parameters] - - -[variablelist - -[[option][The new option value to be set on the socket.]] - -[[ec][Set to indicate what error occurred, if any.]] - -] - - - -[heading Example] - -Setting the IPPROTO\_TCP/TCP\_NODELAY option: - - boost::asio::ip::tcp::socket socket(io_context); - ... - boost::asio::ip::tcp::no_delay option(true); - boost::system::error_code ec; - socket.set_option(option, ec); - if (ec) - { - // An error occurred. - } - - - - - - - -[endsect] - - -[endsect] - -[section:shutdown basic_datagram_socket::shutdown] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.shutdown..shutdown..basic_datagram_socket] -Disable sends or receives on the socket. - - - void ``[link boost_asio.reference.basic_datagram_socket.shutdown.overload1 shutdown]``( - shutdown_type what); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.shutdown.overload1 more...]]`` - - void ``[link boost_asio.reference.basic_datagram_socket.shutdown.overload2 shutdown]``( - shutdown_type what, - boost::system::error_code & ec); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.shutdown.overload2 more...]]`` - - -[section:overload1 basic_datagram_socket::shutdown (1 of 2 overloads)] - - -['Inherited from basic_socket.] - - -Disable sends or receives on the socket. - - - void shutdown( - shutdown_type what); - - -This function is used to disable send operations, receive operations, or both. - - -[heading Parameters] - - -[variablelist - -[[what][Determines what types of operation will no longer be allowed.]] - -] - - -[heading Exceptions] - - -[variablelist - -[[boost::system::system_error][Thrown on failure.]] - -] - - -[heading Example] - -Shutting down the send side of the socket: - - boost::asio::ip::tcp::socket socket(io_context); - ... - socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send); - - - - - - - -[endsect] - - - -[section:overload2 basic_datagram_socket::shutdown (2 of 2 overloads)] - - -['Inherited from basic_socket.] - - -Disable sends or receives on the socket. - - - void shutdown( - shutdown_type what, - boost::system::error_code & ec); - - -This function is used to disable send operations, receive operations, or both. - - -[heading Parameters] - - -[variablelist - -[[what][Determines what types of operation will no longer be allowed.]] - -[[ec][Set to indicate what error occurred, if any.]] - -] - - -[heading Example] - -Shutting down the send side of the socket: - - boost::asio::ip::tcp::socket socket(io_context); - ... - boost::system::error_code ec; - socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send, ec); - if (ec) - { - // An error occurred. - } - - - - - - - -[endsect] - - -[endsect] - - -[section:shutdown_type basic_datagram_socket::shutdown_type] - - -['Inherited from socket_base.] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.shutdown_type..shutdown_type..basic_datagram_socket] -Different ways a socket may be shutdown. - - - enum shutdown_type - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.shutdown_type.shutdown_receive..shutdown_receive..basic_datagram_socket] -[indexterm2 boost_asio.indexterm.basic_datagram_socket.shutdown_type.shutdown_send..shutdown_send..basic_datagram_socket] -[indexterm2 boost_asio.indexterm.basic_datagram_socket.shutdown_type.shutdown_both..shutdown_both..basic_datagram_socket] - -[heading Values] -[variablelist - - [ - [shutdown_receive] - [Shutdown the receive side of the socket. ] - ] - - [ - [shutdown_send] - [Shutdown the send side of the socket. ] - ] - - [ - [shutdown_both] - [Shutdown both send and receive on the socket. ] - ] - -] - - - -[endsect] - - -[section:wait basic_datagram_socket::wait] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.wait..wait..basic_datagram_socket] -Wait for the socket to become ready to read, ready to write, or to have pending error conditions. - - - void ``[link boost_asio.reference.basic_datagram_socket.wait.overload1 wait]``( - wait_type w); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.wait.overload1 more...]]`` - - void ``[link boost_asio.reference.basic_datagram_socket.wait.overload2 wait]``( - wait_type w, - boost::system::error_code & ec); - `` [''''»''' [link boost_asio.reference.basic_datagram_socket.wait.overload2 more...]]`` - - -[section:overload1 basic_datagram_socket::wait (1 of 2 overloads)] - - -['Inherited from basic_socket.] - - -Wait for the socket to become ready to read, ready to write, or to have pending error conditions. - - - void wait( - wait_type w); - - -This function is used to perform a blocking wait for a socket to enter a ready to read, write or error condition state. - - -[heading Parameters] - - -[variablelist - -[[w][Specifies the desired socket state.]] - -] - - -[heading Example] - -Waiting for a socket to become readable. - - boost::asio::ip::tcp::socket socket(io_context); - ... - socket.wait(boost::asio::ip::tcp::socket::wait_read); - - - - - - - -[endsect] - - - -[section:overload2 basic_datagram_socket::wait (2 of 2 overloads)] - - -['Inherited from basic_socket.] - - -Wait for the socket to become ready to read, ready to write, or to have pending error conditions. - - - void wait( - wait_type w, - boost::system::error_code & ec); - - -This function is used to perform a blocking wait for a socket to enter a ready to read, write or error condition state. - - -[heading Parameters] - - -[variablelist - -[[w][Specifies the desired socket state.]] - -[[ec][Set to indicate what error occurred, if any.]] - -] - - -[heading Example] - -Waiting for a socket to become readable. - - boost::asio::ip::tcp::socket socket(io_context); - ... - boost::system::error_code ec; - socket.wait(boost::asio::ip::tcp::socket::wait_read, ec); - - - - - - - -[endsect] - - -[endsect] - - -[section:wait_type basic_datagram_socket::wait_type] - - -['Inherited from socket_base.] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.wait_type..wait_type..basic_datagram_socket] -Wait types. - - - enum wait_type - -[indexterm2 boost_asio.indexterm.basic_datagram_socket.wait_type.wait_read..wait_read..basic_datagram_socket] -[indexterm2 boost_asio.indexterm.basic_datagram_socket.wait_type.wait_write..wait_write..basic_datagram_socket] -[indexterm2 boost_asio.indexterm.basic_datagram_socket.wait_type.wait_error..wait_error..basic_datagram_socket] - -[heading Values] -[variablelist - - [ - [wait_read] - [Wait for a socket to become ready to read. ] - ] - - [ - [wait_write] - [Wait for a socket to become ready to write. ] - ] - - [ - [wait_error] - [Wait for a socket to have error conditions pending. ] - ] - -] - - -For use with `basic_socket::wait()` and `basic_socket::async_wait()`. - - -[endsect] - - - -[section:_basic_datagram_socket basic_datagram_socket::~basic_datagram_socket] - -[indexterm2 boost_asio.indexterm.basic_datagram_socket._basic_datagram_socket..~basic_datagram_socket..basic_datagram_socket] -Destroys the socket. - - - ~basic_datagram_socket(); - - -This function destroys the socket, cancelling any outstanding asynchronous operations associated with the socket as if by calling `cancel`. - - -[endsect] - - - -[endsect] - -[section:basic_deadline_timer basic_deadline_timer] - - -Provides waitable timer functionality. - - - template< - typename Time, - typename ``[link boost_asio.reference.TimeTraits TimeTraits]`` = boost::asio::time_traits