mirror of
https://github.com/boostorg/asio.git
synced 2026-01-27 18:42:07 +00:00
------------------------------------------------------------------------ r85735 | chris_kohlhoff | 2013-09-18 07:31:55 +1000 (Wed, 18 Sep 2013) | 1 line Remove dependency on Boost.Preprocessor library. ------------------------------------------------------------------------ r85736 | chris_kohlhoff | 2013-09-18 07:32:48 +1000 (Wed, 18 Sep 2013) | 1 line Fix error in async_receive_from example. ------------------------------------------------------------------------ r85737 | chris_kohlhoff | 2013-09-18 07:33:39 +1000 (Wed, 18 Sep 2013) | 1 line Remove unused variable assignment. ------------------------------------------------------------------------ r85738 | chris_kohlhoff | 2013-09-18 07:35:43 +1000 (Wed, 18 Sep 2013) | 3 lines Fix a regression where, on some platforms, errors from async_connect are not correctly propagated through to the completion handler. ------------------------------------------------------------------------ r85739 | chris_kohlhoff | 2013-09-18 07:36:54 +1000 (Wed, 18 Sep 2013) | 1 line Remove unused parameters and member variables. ------------------------------------------------------------------------ r85740 | chris_kohlhoff | 2013-09-18 07:38:41 +1000 (Wed, 18 Sep 2013) | 1 line Fix nfds argument to select. ------------------------------------------------------------------------ r85741 | chris_kohlhoff | 2013-09-18 07:39:38 +1000 (Wed, 18 Sep 2013) | 1 line Fix a regression on Windows where multiple threads are running an io_service. ------------------------------------------------------------------------ r85742 | chris_kohlhoff | 2013-09-18 07:40:19 +1000 (Wed, 18 Sep 2013) | 1 line Fix typo in serial ports overview. ------------------------------------------------------------------------ r85743 | chris_kohlhoff | 2013-09-18 07:41:04 +1000 (Wed, 18 Sep 2013) | 1 line Ensure ssl::io_op::want_ member is initialised. ------------------------------------------------------------------------ r85744 | chris_kohlhoff | 2013-09-18 07:42:08 +1000 (Wed, 18 Sep 2013) | 1 line Fix a bug in handler tracking, where it was not correctly printing out some handler IDs. ------------------------------------------------------------------------ r85745 | chris_kohlhoff | 2013-09-18 07:42:48 +1000 (Wed, 18 Sep 2013) | 1 line Fix comparison used to test for a successful synchronous accept. ------------------------------------------------------------------------ r85746 | chris_kohlhoff | 2013-09-18 07:43:29 +1000 (Wed, 18 Sep 2013) | 3 lines Ensure signal number is correctly passed to the completion handler when starting an async_wait on a signal that is already raised. ------------------------------------------------------------------------ r85747 | chris_kohlhoff | 2013-09-18 07:45:43 +1000 (Wed, 18 Sep 2013) | 1 line Suppress g++ 4.8+ warning about unused typedefs. ------------------------------------------------------------------------ r85748 | chris_kohlhoff | 2013-09-18 07:48:54 +1000 (Wed, 18 Sep 2013) | 1 line Fix link to refer to native_handle() rather than the deprecated native() function. ------------------------------------------------------------------------ r85749 | chris_kohlhoff | 2013-09-18 07:51:28 +1000 (Wed, 18 Sep 2013) | 3 lines Enable the move optimisation (and otherwise eliminate a copy) for handlers using the default invocation hook. ------------------------------------------------------------------------ r85750 | chris_kohlhoff | 2013-09-18 07:52:27 +1000 (Wed, 18 Sep 2013) | 2 lines Clarify that programs must not issue overlapping async_write_at operations. ------------------------------------------------------------------------ r85751 | chris_kohlhoff | 2013-09-18 07:53:03 +1000 (Wed, 18 Sep 2013) | 1 line Fix error in comment. ------------------------------------------------------------------------ r85752 | chris_kohlhoff | 2013-09-18 07:53:45 +1000 (Wed, 18 Sep 2013) | 1 line Remove spurious whitespace. ------------------------------------------------------------------------ r85753 | chris_kohlhoff | 2013-09-18 08:00:53 +1000 (Wed, 18 Sep 2013) | 2 lines Clean up some internal forward declarations. ------------------------------------------------------------------------ r85754 | chris_kohlhoff | 2013-09-18 08:01:26 +1000 (Wed, 18 Sep 2013) | 1 line Add missing move cast. ------------------------------------------------------------------------ r85755 | chris_kohlhoff | 2013-09-18 08:03:29 +1000 (Wed, 18 Sep 2013) | 3 lines Fix another socket descriptor comparison that doesn't work correctly if the descriptor type is unsigned. ------------------------------------------------------------------------ r85756 | chris_kohlhoff | 2013-09-18 08:04:10 +1000 (Wed, 18 Sep 2013) | 3 lines Fix documentation error where an asynchronous function was described as having synchronous behaviour. ------------------------------------------------------------------------ r85757 | chris_kohlhoff | 2013-09-18 08:04:55 +1000 (Wed, 18 Sep 2013) | 1 line Add missing forward declarations needed for Windows. ------------------------------------------------------------------------ r85758 | chris_kohlhoff | 2013-09-18 08:05:38 +1000 (Wed, 18 Sep 2013) | 1 line Remove use of std::min. ------------------------------------------------------------------------ r85759 | chris_kohlhoff | 2013-09-18 08:06:25 +1000 (Wed, 18 Sep 2013) | 3 lines Inore ERROR_MORE_DATA as a non-fatal error when returned by GetOverlappedResult for a synchronous read. ------------------------------------------------------------------------ r85760 | chris_kohlhoff | 2013-09-18 08:08:07 +1000 (Wed, 18 Sep 2013) | 2 lines Enable certain C++11 standard library facilities for recent versions of Microsoft Visual Studio. ------------------------------------------------------------------------ r85761 | chris_kohlhoff | 2013-09-18 08:08:43 +1000 (Wed, 18 Sep 2013) | 4 lines Visual C++ language extensions use generic as a keyword. Add a workaround that renames the namespace to cpp_generic when those language extensions are in effect. ------------------------------------------------------------------------ r85762 | chris_kohlhoff | 2013-09-18 08:12:07 +1000 (Wed, 18 Sep 2013) | 2 lines Some async operations that missed getting the async_result treatment. ------------------------------------------------------------------------ r85763 | chris_kohlhoff | 2013-09-18 08:14:14 +1000 (Wed, 18 Sep 2013) | 2 lines Eliminate some unnecessary handler copies. ------------------------------------------------------------------------ r85764 | chris_kohlhoff | 2013-09-18 08:24:19 +1000 (Wed, 18 Sep 2013) | 26 lines Initial port to Windows Runtime. This change adds limited support for using Asio with the Windows Runtime. It requires that the language extensions be enabled. Due to the restricted facilities exposed by the Windows Runtime API, the port 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. ------------------------------------------------------------------------ r85765 | chris_kohlhoff | 2013-09-18 08:32:13 +1000 (Wed, 18 Sep 2013) | 1 line Regenerate documentation. ------------------------------------------------------------------------ r85766 | chris_kohlhoff | 2013-09-18 08:38:04 +1000 (Wed, 18 Sep 2013) | 2 lines Enable move support for Microsoft Visual C++ 2012. ------------------------------------------------------------------------ r85767 | chris_kohlhoff | 2013-09-18 08:42:50 +1000 (Wed, 18 Sep 2013) | 2 lines Add use_future support for Microsoft Visual C++. ------------------------------------------------------------------------ r85768 | chris_kohlhoff | 2013-09-18 08:53:17 +1000 (Wed, 18 Sep 2013) | 2 lines Fix prefix on extern "C" function name. ------------------------------------------------------------------------ r85781 | chris_kohlhoff | 2013-09-19 08:43:01 +1000 (Thu, 19 Sep 2013) | 1 line Implement end-of-file condition for WinRT stream sockets. ------------------------------------------------------------------------ r85798 | chris_kohlhoff | 2013-09-20 22:00:44 +1000 (Fri, 20 Sep 2013) | 2 lines Update buffered stream operations to adhere to current handler patterns. ------------------------------------------------------------------------ r85799 | chris_kohlhoff | 2013-09-20 22:02:33 +1000 (Fri, 20 Sep 2013) | 1 line MinGW fix. ------------------------------------------------------------------------ r85800 | chris_kohlhoff | 2013-09-20 22:04:00 +1000 (Fri, 20 Sep 2013) | 1 line Change unit tests so that they don't depend on Boost.Thread. ------------------------------------------------------------------------ r85801 | chris_kohlhoff | 2013-09-20 22:10:45 +1000 (Fri, 20 Sep 2013) | 1 line Regenerate documentation. ------------------------------------------------------------------------ r85823 | danieljames | 2013-09-22 20:32:36 +1000 (Sun, 22 Sep 2013) | 1 line Fix copying C++11 allocation examples ------------------------------------------------------------------------ [SVN r85838]
926 lines
29 KiB
C++
926 lines
29 KiB
C++
//
|
|
// tcp.cpp
|
|
// ~~~~~~~
|
|
//
|
|
// Copyright (c) 2003-2013 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)
|
|
|
|
// Enable cancel() support on Windows.
|
|
#define BOOST_ASIO_ENABLE_CANCELIO 1
|
|
|
|
// Test that header file is self-contained.
|
|
#include <boost/asio/ip/tcp.hpp>
|
|
|
|
#include <cstring>
|
|
#include <boost/asio/io_service.hpp>
|
|
#include <boost/asio/read.hpp>
|
|
#include <boost/asio/write.hpp>
|
|
#include "../unit_test.hpp"
|
|
#include "../archetypes/gettable_socket_option.hpp"
|
|
#include "../archetypes/async_result.hpp"
|
|
#include "../archetypes/io_control_command.hpp"
|
|
#include "../archetypes/settable_socket_option.hpp"
|
|
|
|
#if defined(BOOST_ASIO_HAS_BOOST_ARRAY)
|
|
# include <boost/array.hpp>
|
|
#else // defined(BOOST_ASIO_HAS_BOOST_ARRAY)
|
|
# include <array>
|
|
#endif // defined(BOOST_ASIO_HAS_BOOST_ARRAY)
|
|
|
|
#if defined(BOOST_ASIO_HAS_BOOST_BIND)
|
|
# include <boost/bind.hpp>
|
|
#else // defined(BOOST_ASIO_HAS_BOOST_BIND)
|
|
# include <functional>
|
|
#endif // defined(BOOST_ASIO_HAS_BOOST_BIND)
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// ip_tcp_compile test
|
|
// ~~~~~~~~~~~~~~~~~~~
|
|
// The following test checks that all nested classes, enums and constants in
|
|
// ip::tcp compile and link correctly. Runtime failures are ignored.
|
|
|
|
namespace ip_tcp_compile {
|
|
|
|
void test()
|
|
{
|
|
using namespace boost::asio;
|
|
namespace ip = boost::asio::ip;
|
|
|
|
try
|
|
{
|
|
io_service ios;
|
|
ip::tcp::socket sock(ios);
|
|
|
|
// no_delay class.
|
|
|
|
ip::tcp::no_delay no_delay1(true);
|
|
sock.set_option(no_delay1);
|
|
ip::tcp::no_delay no_delay2;
|
|
sock.get_option(no_delay2);
|
|
no_delay1 = true;
|
|
(void)static_cast<bool>(no_delay1);
|
|
(void)static_cast<bool>(!no_delay1);
|
|
(void)static_cast<bool>(no_delay1.value());
|
|
}
|
|
catch (std::exception&)
|
|
{
|
|
}
|
|
}
|
|
|
|
} // namespace ip_tcp_compile
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// ip_tcp_runtime test
|
|
// ~~~~~~~~~~~~~~~~~~~
|
|
// The following test checks the runtime operation of the ip::tcp class.
|
|
|
|
namespace ip_tcp_runtime {
|
|
|
|
void test()
|
|
{
|
|
using namespace boost::asio;
|
|
namespace ip = boost::asio::ip;
|
|
|
|
io_service ios;
|
|
ip::tcp::socket sock(ios, ip::tcp::v4());
|
|
boost::system::error_code ec;
|
|
|
|
// no_delay class.
|
|
|
|
ip::tcp::no_delay no_delay1(true);
|
|
BOOST_ASIO_CHECK(no_delay1.value());
|
|
BOOST_ASIO_CHECK(static_cast<bool>(no_delay1));
|
|
BOOST_ASIO_CHECK(!!no_delay1);
|
|
sock.set_option(no_delay1, ec);
|
|
BOOST_ASIO_CHECK(!ec);
|
|
|
|
ip::tcp::no_delay no_delay2;
|
|
sock.get_option(no_delay2, ec);
|
|
BOOST_ASIO_CHECK(!ec);
|
|
BOOST_ASIO_CHECK(no_delay2.value());
|
|
BOOST_ASIO_CHECK(static_cast<bool>(no_delay2));
|
|
BOOST_ASIO_CHECK(!!no_delay2);
|
|
|
|
ip::tcp::no_delay no_delay3(false);
|
|
BOOST_ASIO_CHECK(!no_delay3.value());
|
|
BOOST_ASIO_CHECK(!static_cast<bool>(no_delay3));
|
|
BOOST_ASIO_CHECK(!no_delay3);
|
|
sock.set_option(no_delay3, ec);
|
|
BOOST_ASIO_CHECK(!ec);
|
|
|
|
ip::tcp::no_delay no_delay4;
|
|
sock.get_option(no_delay4, ec);
|
|
BOOST_ASIO_CHECK(!ec);
|
|
BOOST_ASIO_CHECK(!no_delay4.value());
|
|
BOOST_ASIO_CHECK(!static_cast<bool>(no_delay4));
|
|
BOOST_ASIO_CHECK(!no_delay4);
|
|
}
|
|
|
|
} // namespace ip_tcp_runtime
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// ip_tcp_socket_compile test
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// The following test checks that all public member functions on the class
|
|
// ip::tcp::socket compile and link correctly. Runtime failures are ignored.
|
|
|
|
namespace ip_tcp_socket_compile {
|
|
|
|
void connect_handler(const boost::system::error_code&)
|
|
{
|
|
}
|
|
|
|
void send_handler(const boost::system::error_code&, std::size_t)
|
|
{
|
|
}
|
|
|
|
void receive_handler(const boost::system::error_code&, std::size_t)
|
|
{
|
|
}
|
|
|
|
void write_some_handler(const boost::system::error_code&, std::size_t)
|
|
{
|
|
}
|
|
|
|
void read_some_handler(const boost::system::error_code&, std::size_t)
|
|
{
|
|
}
|
|
|
|
void test()
|
|
{
|
|
#if defined(BOOST_ASIO_HAS_BOOST_ARRAY)
|
|
using boost::array;
|
|
#else // defined(BOOST_ASIO_HAS_BOOST_ARRAY)
|
|
using std::array;
|
|
#endif // defined(BOOST_ASIO_HAS_BOOST_ARRAY)
|
|
|
|
using namespace boost::asio;
|
|
namespace ip = boost::asio::ip;
|
|
|
|
try
|
|
{
|
|
io_service ios;
|
|
char mutable_char_buffer[128] = "";
|
|
const char const_char_buffer[128] = "";
|
|
array<boost::asio::mutable_buffer, 2> mutable_buffers = {{
|
|
boost::asio::buffer(mutable_char_buffer, 10),
|
|
boost::asio::buffer(mutable_char_buffer + 10, 10) }};
|
|
array<boost::asio::const_buffer, 2> const_buffers = {{
|
|
boost::asio::buffer(const_char_buffer, 10),
|
|
boost::asio::buffer(const_char_buffer + 10, 10) }};
|
|
socket_base::message_flags in_flags = 0;
|
|
archetypes::settable_socket_option<void> settable_socket_option1;
|
|
archetypes::settable_socket_option<int> settable_socket_option2;
|
|
archetypes::settable_socket_option<double> settable_socket_option3;
|
|
archetypes::gettable_socket_option<void> gettable_socket_option1;
|
|
archetypes::gettable_socket_option<int> gettable_socket_option2;
|
|
archetypes::gettable_socket_option<double> gettable_socket_option3;
|
|
archetypes::io_control_command io_control_command;
|
|
archetypes::lazy_handler lazy;
|
|
boost::system::error_code ec;
|
|
|
|
// basic_stream_socket constructors.
|
|
|
|
ip::tcp::socket socket1(ios);
|
|
ip::tcp::socket socket2(ios, ip::tcp::v4());
|
|
ip::tcp::socket socket3(ios, ip::tcp::v6());
|
|
ip::tcp::socket socket4(ios, ip::tcp::endpoint(ip::tcp::v4(), 0));
|
|
ip::tcp::socket socket5(ios, ip::tcp::endpoint(ip::tcp::v6(), 0));
|
|
#if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
|
|
int native_socket1 = ::socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
|
ip::tcp::socket socket6(ios, ip::tcp::v4(), native_socket1);
|
|
#endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
|
|
|
|
#if defined(BOOST_ASIO_HAS_MOVE)
|
|
ip::tcp::socket socket7(std::move(socket5));
|
|
#endif // defined(BOOST_ASIO_HAS_MOVE)
|
|
|
|
// basic_stream_socket operators.
|
|
|
|
#if defined(BOOST_ASIO_HAS_MOVE)
|
|
socket1 = ip::tcp::socket(ios);
|
|
socket1 = std::move(socket2);
|
|
#endif // defined(BOOST_ASIO_HAS_MOVE)
|
|
|
|
// basic_io_object functions.
|
|
|
|
io_service& ios_ref = socket1.get_io_service();
|
|
(void)ios_ref;
|
|
|
|
// basic_socket functions.
|
|
|
|
ip::tcp::socket::lowest_layer_type& lowest_layer = socket1.lowest_layer();
|
|
(void)lowest_layer;
|
|
|
|
const ip::tcp::socket& socket8 = socket1;
|
|
const ip::tcp::socket::lowest_layer_type& lowest_layer2
|
|
= socket8.lowest_layer();
|
|
(void)lowest_layer2;
|
|
|
|
socket1.open(ip::tcp::v4());
|
|
socket1.open(ip::tcp::v6());
|
|
socket1.open(ip::tcp::v4(), ec);
|
|
socket1.open(ip::tcp::v6(), ec);
|
|
|
|
#if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
|
|
int native_socket2 = ::socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
|
socket1.assign(ip::tcp::v4(), native_socket2);
|
|
int native_socket3 = ::socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
|
socket1.assign(ip::tcp::v4(), native_socket3, ec);
|
|
#endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
|
|
|
|
bool is_open = socket1.is_open();
|
|
(void)is_open;
|
|
|
|
socket1.close();
|
|
socket1.close(ec);
|
|
|
|
ip::tcp::socket::native_type native_socket4 = socket1.native();
|
|
(void)native_socket4;
|
|
|
|
ip::tcp::socket::native_handle_type native_socket5
|
|
= socket1.native_handle();
|
|
(void)native_socket5;
|
|
|
|
socket1.cancel();
|
|
socket1.cancel(ec);
|
|
|
|
bool at_mark1 = socket1.at_mark();
|
|
(void)at_mark1;
|
|
bool at_mark2 = socket1.at_mark(ec);
|
|
(void)at_mark2;
|
|
|
|
std::size_t available1 = socket1.available();
|
|
(void)available1;
|
|
std::size_t available2 = socket1.available(ec);
|
|
(void)available2;
|
|
|
|
socket1.bind(ip::tcp::endpoint(ip::tcp::v4(), 0));
|
|
socket1.bind(ip::tcp::endpoint(ip::tcp::v6(), 0));
|
|
socket1.bind(ip::tcp::endpoint(ip::tcp::v4(), 0), ec);
|
|
socket1.bind(ip::tcp::endpoint(ip::tcp::v6(), 0), ec);
|
|
|
|
socket1.connect(ip::tcp::endpoint(ip::tcp::v4(), 0));
|
|
socket1.connect(ip::tcp::endpoint(ip::tcp::v6(), 0));
|
|
socket1.connect(ip::tcp::endpoint(ip::tcp::v4(), 0), ec);
|
|
socket1.connect(ip::tcp::endpoint(ip::tcp::v6(), 0), ec);
|
|
|
|
socket1.async_connect(ip::tcp::endpoint(ip::tcp::v4(), 0),
|
|
&connect_handler);
|
|
socket1.async_connect(ip::tcp::endpoint(ip::tcp::v6(), 0),
|
|
&connect_handler);
|
|
int i1 = socket1.async_connect(ip::tcp::endpoint(ip::tcp::v4(), 0), lazy);
|
|
(void)i1;
|
|
int i2 = socket1.async_connect(ip::tcp::endpoint(ip::tcp::v6(), 0), lazy);
|
|
(void)i2;
|
|
|
|
socket1.set_option(settable_socket_option1);
|
|
socket1.set_option(settable_socket_option1, ec);
|
|
socket1.set_option(settable_socket_option2);
|
|
socket1.set_option(settable_socket_option2, ec);
|
|
socket1.set_option(settable_socket_option3);
|
|
socket1.set_option(settable_socket_option3, ec);
|
|
|
|
socket1.get_option(gettable_socket_option1);
|
|
socket1.get_option(gettable_socket_option1, ec);
|
|
socket1.get_option(gettable_socket_option2);
|
|
socket1.get_option(gettable_socket_option2, ec);
|
|
socket1.get_option(gettable_socket_option3);
|
|
socket1.get_option(gettable_socket_option3, ec);
|
|
|
|
socket1.io_control(io_control_command);
|
|
socket1.io_control(io_control_command, ec);
|
|
|
|
bool non_blocking1 = socket1.non_blocking();
|
|
(void)non_blocking1;
|
|
socket1.non_blocking(true);
|
|
socket1.non_blocking(false, ec);
|
|
|
|
bool non_blocking2 = socket1.native_non_blocking();
|
|
(void)non_blocking2;
|
|
socket1.native_non_blocking(true);
|
|
socket1.native_non_blocking(false, ec);
|
|
|
|
ip::tcp::endpoint endpoint1 = socket1.local_endpoint();
|
|
ip::tcp::endpoint endpoint2 = socket1.local_endpoint(ec);
|
|
|
|
ip::tcp::endpoint endpoint3 = socket1.remote_endpoint();
|
|
ip::tcp::endpoint endpoint4 = socket1.remote_endpoint(ec);
|
|
|
|
socket1.shutdown(socket_base::shutdown_both);
|
|
socket1.shutdown(socket_base::shutdown_both, ec);
|
|
|
|
// basic_stream_socket functions.
|
|
|
|
socket1.send(buffer(mutable_char_buffer));
|
|
socket1.send(buffer(const_char_buffer));
|
|
socket1.send(mutable_buffers);
|
|
socket1.send(const_buffers);
|
|
socket1.send(null_buffers());
|
|
socket1.send(buffer(mutable_char_buffer), in_flags);
|
|
socket1.send(buffer(const_char_buffer), in_flags);
|
|
socket1.send(mutable_buffers, in_flags);
|
|
socket1.send(const_buffers, in_flags);
|
|
socket1.send(null_buffers(), in_flags);
|
|
socket1.send(buffer(mutable_char_buffer), in_flags, ec);
|
|
socket1.send(buffer(const_char_buffer), in_flags, ec);
|
|
socket1.send(mutable_buffers, in_flags, ec);
|
|
socket1.send(const_buffers, in_flags, ec);
|
|
socket1.send(null_buffers(), in_flags, ec);
|
|
|
|
socket1.async_send(buffer(mutable_char_buffer), &send_handler);
|
|
socket1.async_send(buffer(const_char_buffer), &send_handler);
|
|
socket1.async_send(mutable_buffers, &send_handler);
|
|
socket1.async_send(const_buffers, &send_handler);
|
|
socket1.async_send(null_buffers(), &send_handler);
|
|
socket1.async_send(buffer(mutable_char_buffer), in_flags, &send_handler);
|
|
socket1.async_send(buffer(const_char_buffer), in_flags, &send_handler);
|
|
socket1.async_send(mutable_buffers, in_flags, &send_handler);
|
|
socket1.async_send(const_buffers, in_flags, &send_handler);
|
|
socket1.async_send(null_buffers(), in_flags, &send_handler);
|
|
int i3 = socket1.async_send(buffer(mutable_char_buffer), lazy);
|
|
(void)i3;
|
|
int i4 = socket1.async_send(buffer(const_char_buffer), lazy);
|
|
(void)i4;
|
|
int i5 = socket1.async_send(mutable_buffers, lazy);
|
|
(void)i5;
|
|
int i6 = socket1.async_send(const_buffers, lazy);
|
|
(void)i6;
|
|
int i7 = socket1.async_send(null_buffers(), lazy);
|
|
(void)i7;
|
|
int i8 = socket1.async_send(buffer(mutable_char_buffer), in_flags, lazy);
|
|
(void)i8;
|
|
int i9 = socket1.async_send(buffer(const_char_buffer), in_flags, lazy);
|
|
(void)i9;
|
|
int i10 = socket1.async_send(mutable_buffers, in_flags, lazy);
|
|
(void)i10;
|
|
int i11 = socket1.async_send(const_buffers, in_flags, lazy);
|
|
(void)i11;
|
|
int i12 = socket1.async_send(null_buffers(), in_flags, lazy);
|
|
(void)i12;
|
|
|
|
socket1.receive(buffer(mutable_char_buffer));
|
|
socket1.receive(mutable_buffers);
|
|
socket1.receive(null_buffers());
|
|
socket1.receive(buffer(mutable_char_buffer), in_flags);
|
|
socket1.receive(mutable_buffers, in_flags);
|
|
socket1.receive(null_buffers(), in_flags);
|
|
socket1.receive(buffer(mutable_char_buffer), in_flags, ec);
|
|
socket1.receive(mutable_buffers, in_flags, ec);
|
|
socket1.receive(null_buffers(), in_flags, ec);
|
|
|
|
socket1.async_receive(buffer(mutable_char_buffer), &receive_handler);
|
|
socket1.async_receive(mutable_buffers, &receive_handler);
|
|
socket1.async_receive(null_buffers(), &receive_handler);
|
|
socket1.async_receive(buffer(mutable_char_buffer), in_flags,
|
|
&receive_handler);
|
|
socket1.async_receive(mutable_buffers, in_flags, &receive_handler);
|
|
socket1.async_receive(null_buffers(), in_flags, &receive_handler);
|
|
int i13 = socket1.async_receive(buffer(mutable_char_buffer), lazy);
|
|
(void)i13;
|
|
int i14 = socket1.async_receive(mutable_buffers, lazy);
|
|
(void)i14;
|
|
int i15 = socket1.async_receive(null_buffers(), lazy);
|
|
(void)i15;
|
|
int i16 = socket1.async_receive(buffer(mutable_char_buffer), in_flags,
|
|
lazy);
|
|
(void)i16;
|
|
int i17 = socket1.async_receive(mutable_buffers, in_flags, lazy);
|
|
(void)i17;
|
|
int i18 = socket1.async_receive(null_buffers(), in_flags, lazy);
|
|
(void)i18;
|
|
|
|
socket1.write_some(buffer(mutable_char_buffer));
|
|
socket1.write_some(buffer(const_char_buffer));
|
|
socket1.write_some(mutable_buffers);
|
|
socket1.write_some(const_buffers);
|
|
socket1.write_some(null_buffers());
|
|
socket1.write_some(buffer(mutable_char_buffer), ec);
|
|
socket1.write_some(buffer(const_char_buffer), ec);
|
|
socket1.write_some(mutable_buffers, ec);
|
|
socket1.write_some(const_buffers, ec);
|
|
socket1.write_some(null_buffers(), ec);
|
|
|
|
socket1.async_write_some(buffer(mutable_char_buffer), &write_some_handler);
|
|
socket1.async_write_some(buffer(const_char_buffer), &write_some_handler);
|
|
socket1.async_write_some(mutable_buffers, &write_some_handler);
|
|
socket1.async_write_some(const_buffers, &write_some_handler);
|
|
socket1.async_write_some(null_buffers(), &write_some_handler);
|
|
int i19 = socket1.async_write_some(buffer(mutable_char_buffer), lazy);
|
|
(void)i19;
|
|
int i20 = socket1.async_write_some(buffer(const_char_buffer), lazy);
|
|
(void)i20;
|
|
int i21 = socket1.async_write_some(mutable_buffers, lazy);
|
|
(void)i21;
|
|
int i22 = socket1.async_write_some(const_buffers, lazy);
|
|
(void)i22;
|
|
int i23 = socket1.async_write_some(null_buffers(), lazy);
|
|
(void)i23;
|
|
|
|
socket1.read_some(buffer(mutable_char_buffer));
|
|
socket1.read_some(mutable_buffers);
|
|
socket1.read_some(null_buffers());
|
|
socket1.read_some(buffer(mutable_char_buffer), ec);
|
|
socket1.read_some(mutable_buffers, ec);
|
|
socket1.read_some(null_buffers(), ec);
|
|
|
|
socket1.async_read_some(buffer(mutable_char_buffer), &read_some_handler);
|
|
socket1.async_read_some(mutable_buffers, &read_some_handler);
|
|
socket1.async_read_some(null_buffers(), &read_some_handler);
|
|
int i24 = socket1.async_read_some(buffer(mutable_char_buffer), lazy);
|
|
(void)i24;
|
|
int i25 = socket1.async_read_some(mutable_buffers, lazy);
|
|
(void)i25;
|
|
int i26 = socket1.async_read_some(null_buffers(), lazy);
|
|
(void)i26;
|
|
}
|
|
catch (std::exception&)
|
|
{
|
|
}
|
|
}
|
|
|
|
} // namespace ip_tcp_socket_compile
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// ip_tcp_socket_runtime test
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// The following test checks the runtime operation of the ip::tcp::socket class.
|
|
|
|
namespace ip_tcp_socket_runtime {
|
|
|
|
static const char write_data[]
|
|
= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
|
|
void handle_read_noop(const boost::system::error_code& err,
|
|
size_t bytes_transferred, bool* called)
|
|
{
|
|
*called = true;
|
|
BOOST_ASIO_CHECK(!err);
|
|
BOOST_ASIO_CHECK(bytes_transferred == 0);
|
|
}
|
|
|
|
void handle_write_noop(const boost::system::error_code& err,
|
|
size_t bytes_transferred, bool* called)
|
|
{
|
|
*called = true;
|
|
BOOST_ASIO_CHECK(!err);
|
|
BOOST_ASIO_CHECK(bytes_transferred == 0);
|
|
}
|
|
|
|
void handle_read(const boost::system::error_code& err,
|
|
size_t bytes_transferred, bool* called)
|
|
{
|
|
*called = true;
|
|
BOOST_ASIO_CHECK(!err);
|
|
BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data));
|
|
}
|
|
|
|
void handle_write(const boost::system::error_code& err,
|
|
size_t bytes_transferred, bool* called)
|
|
{
|
|
*called = true;
|
|
BOOST_ASIO_CHECK(!err);
|
|
BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data));
|
|
}
|
|
|
|
void handle_read_cancel(const boost::system::error_code& err,
|
|
size_t bytes_transferred, bool* called)
|
|
{
|
|
*called = true;
|
|
BOOST_ASIO_CHECK(err == boost::asio::error::operation_aborted);
|
|
BOOST_ASIO_CHECK(bytes_transferred == 0);
|
|
}
|
|
|
|
void handle_read_eof(const boost::system::error_code& err,
|
|
size_t bytes_transferred, bool* called)
|
|
{
|
|
*called = true;
|
|
BOOST_ASIO_CHECK(err == boost::asio::error::eof);
|
|
BOOST_ASIO_CHECK(bytes_transferred == 0);
|
|
}
|
|
|
|
void test()
|
|
{
|
|
using namespace std; // For memcmp.
|
|
using namespace boost::asio;
|
|
namespace ip = boost::asio::ip;
|
|
|
|
#if defined(BOOST_ASIO_HAS_BOOST_BIND)
|
|
namespace bindns = boost;
|
|
#else // defined(BOOST_ASIO_HAS_BOOST_BIND)
|
|
namespace bindns = std;
|
|
using std::placeholders::_1;
|
|
using std::placeholders::_2;
|
|
#endif // defined(BOOST_ASIO_HAS_BOOST_BIND)
|
|
|
|
io_service ios;
|
|
|
|
ip::tcp::acceptor acceptor(ios, ip::tcp::endpoint(ip::tcp::v4(), 0));
|
|
ip::tcp::endpoint server_endpoint = acceptor.local_endpoint();
|
|
server_endpoint.address(ip::address_v4::loopback());
|
|
|
|
ip::tcp::socket client_side_socket(ios);
|
|
ip::tcp::socket server_side_socket(ios);
|
|
|
|
client_side_socket.connect(server_endpoint);
|
|
acceptor.accept(server_side_socket);
|
|
|
|
// No-op read.
|
|
|
|
bool read_noop_completed = false;
|
|
client_side_socket.async_read_some(
|
|
boost::asio::mutable_buffers_1(0, 0),
|
|
bindns::bind(handle_read_noop,
|
|
_1, _2, &read_noop_completed));
|
|
|
|
ios.run();
|
|
BOOST_ASIO_CHECK(read_noop_completed);
|
|
|
|
// No-op write.
|
|
|
|
bool write_noop_completed = false;
|
|
client_side_socket.async_write_some(
|
|
boost::asio::const_buffers_1(0, 0),
|
|
bindns::bind(handle_write_noop,
|
|
_1, _2, &write_noop_completed));
|
|
|
|
ios.reset();
|
|
ios.run();
|
|
BOOST_ASIO_CHECK(write_noop_completed);
|
|
|
|
// Read and write to transfer data.
|
|
|
|
char read_buffer[sizeof(write_data)];
|
|
bool read_completed = false;
|
|
boost::asio::async_read(client_side_socket,
|
|
boost::asio::buffer(read_buffer),
|
|
bindns::bind(handle_read,
|
|
_1, _2, &read_completed));
|
|
|
|
bool write_completed = false;
|
|
boost::asio::async_write(server_side_socket,
|
|
boost::asio::buffer(write_data),
|
|
bindns::bind(handle_write,
|
|
_1, _2, &write_completed));
|
|
|
|
ios.reset();
|
|
ios.run();
|
|
BOOST_ASIO_CHECK(read_completed);
|
|
BOOST_ASIO_CHECK(write_completed);
|
|
BOOST_ASIO_CHECK(memcmp(read_buffer, write_data, sizeof(write_data)) == 0);
|
|
|
|
// Cancelled read.
|
|
|
|
bool read_cancel_completed = false;
|
|
boost::asio::async_read(server_side_socket,
|
|
boost::asio::buffer(read_buffer),
|
|
bindns::bind(handle_read_cancel,
|
|
_1, _2, &read_cancel_completed));
|
|
|
|
ios.reset();
|
|
ios.poll();
|
|
BOOST_ASIO_CHECK(!read_cancel_completed);
|
|
|
|
server_side_socket.cancel();
|
|
|
|
ios.reset();
|
|
ios.run();
|
|
BOOST_ASIO_CHECK(read_cancel_completed);
|
|
|
|
// A read when the peer closes socket should fail with eof.
|
|
|
|
bool read_eof_completed = false;
|
|
boost::asio::async_read(client_side_socket,
|
|
boost::asio::buffer(read_buffer),
|
|
bindns::bind(handle_read_eof,
|
|
_1, _2, &read_eof_completed));
|
|
|
|
server_side_socket.close();
|
|
|
|
ios.reset();
|
|
ios.run();
|
|
BOOST_ASIO_CHECK(read_eof_completed);
|
|
}
|
|
|
|
} // namespace ip_tcp_socket_runtime
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// ip_tcp_acceptor_compile test
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// The following test checks that all public member functions on the class
|
|
// ip::tcp::acceptor compile and link correctly. Runtime failures are ignored.
|
|
|
|
namespace ip_tcp_acceptor_compile {
|
|
|
|
void accept_handler(const boost::system::error_code&)
|
|
{
|
|
}
|
|
|
|
void test()
|
|
{
|
|
using namespace boost::asio;
|
|
namespace ip = boost::asio::ip;
|
|
|
|
try
|
|
{
|
|
io_service ios;
|
|
ip::tcp::socket peer_socket(ios);
|
|
ip::tcp::endpoint peer_endpoint;
|
|
archetypes::settable_socket_option<void> settable_socket_option1;
|
|
archetypes::settable_socket_option<int> settable_socket_option2;
|
|
archetypes::settable_socket_option<double> settable_socket_option3;
|
|
archetypes::gettable_socket_option<void> gettable_socket_option1;
|
|
archetypes::gettable_socket_option<int> gettable_socket_option2;
|
|
archetypes::gettable_socket_option<double> gettable_socket_option3;
|
|
archetypes::io_control_command io_control_command;
|
|
archetypes::lazy_handler lazy;
|
|
boost::system::error_code ec;
|
|
|
|
// basic_socket_acceptor constructors.
|
|
|
|
ip::tcp::acceptor acceptor1(ios);
|
|
ip::tcp::acceptor acceptor2(ios, ip::tcp::v4());
|
|
ip::tcp::acceptor acceptor3(ios, ip::tcp::v6());
|
|
ip::tcp::acceptor acceptor4(ios, ip::tcp::endpoint(ip::tcp::v4(), 0));
|
|
ip::tcp::acceptor acceptor5(ios, ip::tcp::endpoint(ip::tcp::v6(), 0));
|
|
#if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
|
|
int native_acceptor1 = ::socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
|
ip::tcp::acceptor acceptor6(ios, ip::tcp::v4(), native_acceptor1);
|
|
#endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
|
|
|
|
#if defined(BOOST_ASIO_HAS_MOVE)
|
|
ip::tcp::acceptor acceptor7(std::move(acceptor5));
|
|
#endif // defined(BOOST_ASIO_HAS_MOVE)
|
|
|
|
// basic_socket_acceptor operators.
|
|
|
|
#if defined(BOOST_ASIO_HAS_MOVE)
|
|
acceptor1 = ip::tcp::acceptor(ios);
|
|
acceptor1 = std::move(acceptor2);
|
|
#endif // defined(BOOST_ASIO_HAS_MOVE)
|
|
|
|
// basic_io_object functions.
|
|
|
|
io_service& ios_ref = acceptor1.get_io_service();
|
|
(void)ios_ref;
|
|
|
|
// basic_socket_acceptor functions.
|
|
|
|
acceptor1.open(ip::tcp::v4());
|
|
acceptor1.open(ip::tcp::v6());
|
|
acceptor1.open(ip::tcp::v4(), ec);
|
|
acceptor1.open(ip::tcp::v6(), ec);
|
|
|
|
#if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
|
|
int native_acceptor2 = ::socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
|
acceptor1.assign(ip::tcp::v4(), native_acceptor2);
|
|
int native_acceptor3 = ::socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
|
acceptor1.assign(ip::tcp::v4(), native_acceptor3, ec);
|
|
#endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
|
|
|
|
bool is_open = acceptor1.is_open();
|
|
(void)is_open;
|
|
|
|
acceptor1.close();
|
|
acceptor1.close(ec);
|
|
|
|
ip::tcp::acceptor::native_type native_acceptor4 = acceptor1.native();
|
|
(void)native_acceptor4;
|
|
|
|
ip::tcp::acceptor::native_handle_type native_acceptor5
|
|
= acceptor1.native_handle();
|
|
(void)native_acceptor5;
|
|
|
|
acceptor1.cancel();
|
|
acceptor1.cancel(ec);
|
|
|
|
acceptor1.bind(ip::tcp::endpoint(ip::tcp::v4(), 0));
|
|
acceptor1.bind(ip::tcp::endpoint(ip::tcp::v6(), 0));
|
|
acceptor1.bind(ip::tcp::endpoint(ip::tcp::v4(), 0), ec);
|
|
acceptor1.bind(ip::tcp::endpoint(ip::tcp::v6(), 0), ec);
|
|
|
|
acceptor1.set_option(settable_socket_option1);
|
|
acceptor1.set_option(settable_socket_option1, ec);
|
|
acceptor1.set_option(settable_socket_option2);
|
|
acceptor1.set_option(settable_socket_option2, ec);
|
|
acceptor1.set_option(settable_socket_option3);
|
|
acceptor1.set_option(settable_socket_option3, ec);
|
|
|
|
acceptor1.get_option(gettable_socket_option1);
|
|
acceptor1.get_option(gettable_socket_option1, ec);
|
|
acceptor1.get_option(gettable_socket_option2);
|
|
acceptor1.get_option(gettable_socket_option2, ec);
|
|
acceptor1.get_option(gettable_socket_option3);
|
|
acceptor1.get_option(gettable_socket_option3, ec);
|
|
|
|
acceptor1.io_control(io_control_command);
|
|
acceptor1.io_control(io_control_command, ec);
|
|
|
|
bool non_blocking1 = acceptor1.non_blocking();
|
|
(void)non_blocking1;
|
|
acceptor1.non_blocking(true);
|
|
acceptor1.non_blocking(false, ec);
|
|
|
|
bool non_blocking2 = acceptor1.native_non_blocking();
|
|
(void)non_blocking2;
|
|
acceptor1.native_non_blocking(true);
|
|
acceptor1.native_non_blocking(false, ec);
|
|
|
|
ip::tcp::endpoint endpoint1 = acceptor1.local_endpoint();
|
|
ip::tcp::endpoint endpoint2 = acceptor1.local_endpoint(ec);
|
|
|
|
acceptor1.accept(peer_socket);
|
|
acceptor1.accept(peer_socket, ec);
|
|
acceptor1.accept(peer_socket, peer_endpoint);
|
|
acceptor1.accept(peer_socket, peer_endpoint, ec);
|
|
|
|
acceptor1.async_accept(peer_socket, &accept_handler);
|
|
acceptor1.async_accept(peer_socket, peer_endpoint, &accept_handler);
|
|
int i1 = acceptor1.async_accept(peer_socket, lazy);
|
|
(void)i1;
|
|
int i2 = acceptor1.async_accept(peer_socket, peer_endpoint, lazy);
|
|
(void)i2;
|
|
}
|
|
catch (std::exception&)
|
|
{
|
|
}
|
|
}
|
|
|
|
} // namespace ip_tcp_acceptor_compile
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// ip_tcp_acceptor_runtime test
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// The following test checks the runtime operation of the ip::tcp::acceptor
|
|
// class.
|
|
|
|
namespace ip_tcp_acceptor_runtime {
|
|
|
|
void handle_accept(const boost::system::error_code& err)
|
|
{
|
|
BOOST_ASIO_CHECK(!err);
|
|
}
|
|
|
|
void handle_connect(const boost::system::error_code& err)
|
|
{
|
|
BOOST_ASIO_CHECK(!err);
|
|
}
|
|
|
|
void test()
|
|
{
|
|
using namespace boost::asio;
|
|
namespace ip = boost::asio::ip;
|
|
|
|
io_service ios;
|
|
|
|
ip::tcp::acceptor acceptor(ios, ip::tcp::endpoint(ip::tcp::v4(), 0));
|
|
ip::tcp::endpoint server_endpoint = acceptor.local_endpoint();
|
|
server_endpoint.address(ip::address_v4::loopback());
|
|
|
|
ip::tcp::socket client_side_socket(ios);
|
|
ip::tcp::socket server_side_socket(ios);
|
|
|
|
client_side_socket.connect(server_endpoint);
|
|
acceptor.accept(server_side_socket);
|
|
|
|
client_side_socket.close();
|
|
server_side_socket.close();
|
|
|
|
client_side_socket.connect(server_endpoint);
|
|
ip::tcp::endpoint client_endpoint;
|
|
acceptor.accept(server_side_socket, client_endpoint);
|
|
|
|
ip::tcp::acceptor::non_blocking_io command(false);
|
|
acceptor.io_control(command);
|
|
|
|
ip::tcp::endpoint client_side_local_endpoint
|
|
= client_side_socket.local_endpoint();
|
|
BOOST_ASIO_CHECK(client_side_local_endpoint.port() == client_endpoint.port());
|
|
|
|
ip::tcp::endpoint server_side_remote_endpoint
|
|
= server_side_socket.remote_endpoint();
|
|
BOOST_ASIO_CHECK(server_side_remote_endpoint.port()
|
|
== client_endpoint.port());
|
|
|
|
client_side_socket.close();
|
|
server_side_socket.close();
|
|
|
|
acceptor.async_accept(server_side_socket, &handle_accept);
|
|
client_side_socket.async_connect(server_endpoint, &handle_connect);
|
|
|
|
ios.run();
|
|
|
|
client_side_socket.close();
|
|
server_side_socket.close();
|
|
|
|
acceptor.async_accept(server_side_socket, client_endpoint, &handle_accept);
|
|
client_side_socket.async_connect(server_endpoint, &handle_connect);
|
|
|
|
ios.reset();
|
|
ios.run();
|
|
|
|
client_side_local_endpoint = client_side_socket.local_endpoint();
|
|
BOOST_ASIO_CHECK(client_side_local_endpoint.port() == client_endpoint.port());
|
|
|
|
server_side_remote_endpoint = server_side_socket.remote_endpoint();
|
|
BOOST_ASIO_CHECK(server_side_remote_endpoint.port()
|
|
== client_endpoint.port());
|
|
}
|
|
|
|
} // namespace ip_tcp_acceptor_runtime
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// ip_tcp_resolver_compile test
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// The following test checks that all public member functions on the class
|
|
// ip::tcp::resolver compile and link correctly. Runtime failures are ignored.
|
|
|
|
namespace ip_tcp_resolver_compile {
|
|
|
|
void resolve_handler(const boost::system::error_code&,
|
|
boost::asio::ip::tcp::resolver::iterator)
|
|
{
|
|
}
|
|
|
|
void test()
|
|
{
|
|
using namespace boost::asio;
|
|
namespace ip = boost::asio::ip;
|
|
|
|
try
|
|
{
|
|
io_service ios;
|
|
archetypes::lazy_handler lazy;
|
|
boost::system::error_code ec;
|
|
ip::tcp::resolver::query q(ip::tcp::v4(), "localhost", "0");
|
|
ip::tcp::endpoint e(ip::address_v4::loopback(), 0);
|
|
|
|
// basic_resolver constructors.
|
|
|
|
ip::tcp::resolver resolver(ios);
|
|
|
|
// basic_io_object functions.
|
|
|
|
io_service& ios_ref = resolver.get_io_service();
|
|
(void)ios_ref;
|
|
|
|
// basic_resolver functions.
|
|
|
|
resolver.cancel();
|
|
|
|
ip::tcp::resolver::iterator iter1 = resolver.resolve(q);
|
|
(void)iter1;
|
|
|
|
ip::tcp::resolver::iterator iter2 = resolver.resolve(q, ec);
|
|
(void)iter2;
|
|
|
|
ip::tcp::resolver::iterator iter3 = resolver.resolve(e);
|
|
(void)iter3;
|
|
|
|
ip::tcp::resolver::iterator iter4 = resolver.resolve(e, ec);
|
|
(void)iter4;
|
|
|
|
resolver.async_resolve(q, &resolve_handler);
|
|
int i1 = resolver.async_resolve(q, lazy);
|
|
(void)i1;
|
|
|
|
resolver.async_resolve(e, &resolve_handler);
|
|
int i2 = resolver.async_resolve(e, lazy);
|
|
(void)i2;
|
|
}
|
|
catch (std::exception&)
|
|
{
|
|
}
|
|
}
|
|
|
|
} // namespace ip_tcp_resolver_compile
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
BOOST_ASIO_TEST_SUITE
|
|
(
|
|
"ip/tcp",
|
|
BOOST_ASIO_TEST_CASE(ip_tcp_compile::test)
|
|
BOOST_ASIO_TEST_CASE(ip_tcp_runtime::test)
|
|
BOOST_ASIO_TEST_CASE(ip_tcp_socket_compile::test)
|
|
BOOST_ASIO_TEST_CASE(ip_tcp_socket_runtime::test)
|
|
BOOST_ASIO_TEST_CASE(ip_tcp_acceptor_compile::test)
|
|
BOOST_ASIO_TEST_CASE(ip_tcp_acceptor_runtime::test)
|
|
BOOST_ASIO_TEST_CASE(ip_tcp_resolver_compile::test)
|
|
)
|