11 #ifndef ASIO_BASIC_SOCKET_ACCEPTOR_HPP 12 #define ASIO_BASIC_SOCKET_ACCEPTOR_HPP 14 #if defined(_MSC_VER) && (_MSC_VER >= 1200) 16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 18 #include "asio/detail/config.hpp" 19 #include "asio/any_io_executor.hpp" 20 #include "asio/basic_socket.hpp" 21 #include "asio/detail/handler_type_requirements.hpp" 22 #include "asio/detail/io_object_impl.hpp" 23 #include "asio/detail/non_const_lvalue.hpp" 24 #include "asio/detail/throw_error.hpp" 25 #include "asio/detail/type_traits.hpp" 26 #include "asio/error.hpp" 27 #include "asio/execution_context.hpp" 28 #include "asio/socket_base.hpp" 30 #if defined(ASIO_WINDOWS_RUNTIME) 31 # include "asio/detail/null_socket_service.hpp" 32 #elif defined(ASIO_HAS_IOCP) 33 # include "asio/detail/win_iocp_socket_service.hpp" 35 # include "asio/detail/reactive_socket_service.hpp" 38 #if defined(ASIO_HAS_MOVE) 40 #endif // defined(ASIO_HAS_MOVE) 42 #include "asio/detail/push_options.hpp" 46 #if !defined(ASIO_BASIC_SOCKET_ACCEPTOR_FWD_DECL) 47 #define ASIO_BASIC_SOCKET_ACCEPTOR_FWD_DECL 50 template <
typename Protocol,
typename Executor = any_io_executor>
53 #endif // !defined(ASIO_BASIC_SOCKET_ACCEPTOR_FWD_DECL) 75 template <
typename Protocol,
typename Executor>
84 template <
typename Executor1>
92 #if defined(GENERATING_DOCUMENTATION) 94 #elif defined(ASIO_WINDOWS_RUNTIME) 95 typedef typename detail::null_socket_service<
97 #elif defined(ASIO_HAS_IOCP) 98 typedef typename detail::win_iocp_socket_service<
136 template <
typename ExecutionContext>
139 is_convertible<ExecutionContext&, execution_context&>::value
161 impl_.get_service().open(impl_.get_implementation(), protocol, ec);
162 asio::detail::throw_error(ec,
"open");
177 template <
typename ExecutionContext>
179 const protocol_type& protocol,
181 is_convertible<ExecutionContext&, execution_context&>::value
186 impl_.get_service().open(impl_.get_implementation(), protocol, ec);
187 asio::detail::throw_error(ec,
"open");
218 const endpoint_type& endpoint,
bool reuse_addr =
true)
222 const protocol_type protocol = endpoint.protocol();
223 impl_.get_service().open(impl_.get_implementation(), protocol, ec);
224 asio::detail::throw_error(ec,
"open");
227 impl_.get_service().set_option(impl_.get_implementation(),
229 asio::detail::throw_error(ec,
"set_option");
231 impl_.get_service().bind(impl_.get_implementation(), endpoint, ec);
232 asio::detail::throw_error(ec,
"bind");
233 impl_.get_service().listen(impl_.get_implementation(),
234 socket_base::max_listen_connections, ec);
235 asio::detail::throw_error(ec,
"listen");
265 template <
typename ExecutionContext>
267 const endpoint_type& endpoint,
bool reuse_addr =
true,
269 is_convertible<ExecutionContext&, execution_context&>::value
274 const protocol_type protocol = endpoint.protocol();
275 impl_.get_service().open(impl_.get_implementation(), protocol, ec);
276 asio::detail::throw_error(ec,
"open");
279 impl_.get_service().set_option(impl_.get_implementation(),
281 asio::detail::throw_error(ec,
"set_option");
283 impl_.get_service().bind(impl_.get_implementation(), endpoint, ec);
284 asio::detail::throw_error(ec,
"bind");
285 impl_.get_service().listen(impl_.get_implementation(),
286 socket_base::max_listen_connections, ec);
287 asio::detail::throw_error(ec,
"listen");
306 const protocol_type& protocol,
const native_handle_type& native_acceptor)
310 impl_.get_service().
assign(impl_.get_implementation(),
311 protocol, native_acceptor, ec);
312 asio::detail::throw_error(ec,
"assign");
330 template <
typename ExecutionContext>
332 const protocol_type& protocol,
const native_handle_type& native_acceptor,
334 is_convertible<ExecutionContext&, execution_context&>::value
339 impl_.get_service().
assign(impl_.get_implementation(),
340 protocol, native_acceptor, ec);
341 asio::detail::throw_error(ec,
"assign");
344 #if defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) 357 : impl_(std::move(
other.impl_))
374 impl_ = std::move(
other.impl_);
379 template <
typename Protocol1,
typename Executor1>
394 template <
typename Protocol1,
typename Executor1>
397 is_convertible<Protocol1, Protocol>::value
398 && is_convertible<Executor1, Executor>::value
400 : impl_(std::move(
other.impl_))
416 template <
typename Protocol1,
typename Executor1>
418 is_convertible<Protocol1, Protocol>::value
419 && is_convertible<Executor1, Executor>::value,
424 impl_ = std::move(tmp.impl_);
427 #endif // defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) 442 return impl_.get_executor();
463 impl_.get_service().open(impl_.get_implementation(), protocol, ec);
464 asio::detail::throw_error(ec,
"open");
487 ASIO_SYNC_OP_VOID
open(
const protocol_type& protocol,
490 impl_.get_service().open(impl_.get_implementation(), protocol, ec);
491 ASIO_SYNC_OP_VOID_RETURN(ec);
504 void assign(
const protocol_type& protocol,
505 const native_handle_type& native_acceptor)
508 impl_.get_service().
assign(impl_.get_implementation(),
509 protocol, native_acceptor, ec);
510 asio::detail::throw_error(ec,
"assign");
523 ASIO_SYNC_OP_VOID
assign(
const protocol_type& protocol,
526 impl_.get_service().assign(impl_.get_implementation(),
527 protocol, native_acceptor, ec);
528 ASIO_SYNC_OP_VOID_RETURN(ec);
534 return impl_.get_service().is_open(impl_.get_implementation());
555 void bind(
const endpoint_type& endpoint)
558 impl_.get_service().bind(impl_.get_implementation(), endpoint, ec);
559 asio::detail::throw_error(ec,
"bind");
585 ASIO_SYNC_OP_VOID
bind(
const endpoint_type& endpoint,
588 impl_.get_service().bind(impl_.get_implementation(), endpoint, ec);
589 ASIO_SYNC_OP_VOID_RETURN(ec);
602 void listen(
int backlog = socket_base::max_listen_connections)
605 impl_.get_service().listen(impl_.get_implementation(), backlog, ec);
606 asio::detail::throw_error(ec,
"listen");
633 impl_.get_service().listen(impl_.get_implementation(), backlog, ec);
634 ASIO_SYNC_OP_VOID_RETURN(ec);
650 impl_.get_service().close(impl_.get_implementation(), ec);
651 asio::detail::throw_error(ec,
"close");
678 impl_.get_service().close(impl_.get_implementation(), ec);
679 ASIO_SYNC_OP_VOID_RETURN(ec);
695 #if defined(ASIO_MSVC) && (ASIO_MSVC >= 1400) \ 696 && (!defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0603) 697 __declspec(deprecated(
"This function always fails with " 698 "operation_not_supported when used on Windows versions " 699 "prior to Windows 8.1."))
704 native_handle_type
s = impl_.get_service().release(
705 impl_.get_implementation(), ec);
706 asio::detail::throw_error(ec,
"release");
723 #if defined(ASIO_MSVC) && (ASIO_MSVC >= 1400) \ 724 && (!defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0603) 725 __declspec(deprecated(
"This function always fails with " 726 "operation_not_supported when used on Windows versions " 727 "prior to Windows 8.1."))
731 return impl_.get_service().release(impl_.get_implementation(), ec);
742 return impl_.get_service().native_handle(impl_.get_implementation());
756 impl_.get_service().cancel(impl_.get_implementation(), ec);
757 asio::detail::throw_error(ec,
"cancel");
770 impl_.get_service().cancel(impl_.get_implementation(), ec);
771 ASIO_SYNC_OP_VOID_RETURN(ec);
795 template <
typename SettableSocketOption>
799 impl_.get_service().set_option(impl_.get_implementation(), option, ec);
800 asio::detail::throw_error(ec,
"set_option");
829 template <
typename SettableSocketOption>
833 impl_.get_service().set_option(impl_.get_implementation(), option, ec);
834 ASIO_SYNC_OP_VOID_RETURN(ec);
859 template <
typename GettableSocketOption>
863 impl_.get_service().get_option(impl_.get_implementation(), option, ec);
864 asio::detail::throw_error(ec,
"get_option");
894 template <
typename GettableSocketOption>
898 impl_.get_service().get_option(impl_.get_implementation(), option, ec);
899 ASIO_SYNC_OP_VOID_RETURN(ec);
922 template <
typename IoControlCommand>
926 impl_.get_service().io_control(impl_.get_implementation(), command, ec);
927 asio::detail::throw_error(ec,
"io_control");
955 template <
typename IoControlCommand>
959 impl_.get_service().io_control(impl_.get_implementation(), command, ec);
960 ASIO_SYNC_OP_VOID_RETURN(ec);
976 return impl_.get_service().non_blocking(impl_.get_implementation());
995 impl_.get_service().non_blocking(impl_.get_implementation(), mode, ec);
996 asio::detail::throw_error(ec,
"non_blocking");
1015 impl_.get_service().non_blocking(impl_.get_implementation(), mode, ec);
1016 ASIO_SYNC_OP_VOID_RETURN(ec);
1035 return impl_.get_service().native_non_blocking(impl_.get_implementation());
1056 impl_.get_service().native_non_blocking(
1057 impl_.get_implementation(), mode, ec);
1058 asio::detail::throw_error(ec,
"native_non_blocking");
1079 impl_.get_service().native_non_blocking(
1080 impl_.get_implementation(), mode, ec);
1081 ASIO_SYNC_OP_VOID_RETURN(ec);
1102 endpoint_type ep = impl_.get_service().local_endpoint(
1103 impl_.get_implementation(), ec);
1104 asio::detail::throw_error(ec,
"local_endpoint");
1132 return impl_.get_service().local_endpoint(impl_.get_implementation(), ec);
1154 impl_.get_service().wait(impl_.get_implementation(), w, ec);
1155 asio::detail::throw_error(ec,
"wait");
1179 impl_.get_service().wait(impl_.get_implementation(), w, ec);
1180 ASIO_SYNC_OP_VOID_RETURN(ec);
1223 WaitHandler ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
1227 ASIO_MOVE_ARG(WaitHandler) handler
1228 ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
1230 return async_initiate<WaitHandler, void (asio::error_code)>(
1231 initiate_async_wait(
this), handler, w);
1234 #if !defined(ASIO_NO_EXTENSIONS) 1253 template <
typename Protocol1,
typename Executor1>
1256 is_convertible<Protocol, Protocol1>::value
1260 impl_.get_service().accept(impl_.get_implementation(),
1261 peer,
static_cast<endpoint_type*
>(0), ec);
1262 asio::detail::throw_error(ec,
"accept");
1288 template <
typename Protocol1,
typename Executor1>
1292 is_convertible<Protocol, Protocol1>::value
1295 impl_.get_service().accept(impl_.get_implementation(),
1296 peer,
static_cast<endpoint_type*
>(0), ec);
1297 ASIO_SYNC_OP_VOID_RETURN(ec);
1338 template <
typename Protocol1,
typename Executor1,
1340 AcceptHandler ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
1344 ASIO_MOVE_ARG(AcceptHandler) handler
1345 ASIO_DEFAULT_COMPLETION_TOKEN(executor_type),
1347 is_convertible<Protocol, Protocol1>::value
1350 return async_initiate<AcceptHandler, void (asio::error_code)>(
1351 initiate_async_accept(
this), handler,
1352 &peer,
static_cast<endpoint_type*
>(0));
1378 template <
typename Executor1>
1380 endpoint_type& peer_endpoint)
1383 impl_.get_service().accept(impl_.get_implementation(),
1384 peer, &peer_endpoint, ec);
1385 asio::detail::throw_error(ec,
"accept");
1416 template <
typename Executor1>
1420 impl_.get_service().accept(
1421 impl_.get_implementation(), peer, &peer_endpoint, ec);
1422 ASIO_SYNC_OP_VOID_RETURN(ec);
1451 template <
typename Executor1,
1453 AcceptHandler ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
1457 endpoint_type& peer_endpoint,
1458 ASIO_MOVE_ARG(AcceptHandler) handler
1459 ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
1461 return async_initiate<AcceptHandler, void (asio::error_code)>(
1462 initiate_async_accept(
this), handler, &peer, &peer_endpoint);
1464 #endif // !defined(ASIO_NO_EXTENSIONS) 1466 #if defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) 1492 executor_type>
::other peer(impl_.get_executor());
1493 impl_.get_service().accept(impl_.get_implementation(), peer, 0, ec);
1494 asio::detail::throw_error(ec,
"accept");
1527 executor_type>
::other peer(impl_.get_executor());
1528 impl_.get_service().accept(impl_.get_implementation(), peer, 0, ec);
1576 executor_type>::
other)) MoveAcceptHandler
1577 ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
1580 typename Protocol::socket::template
1583 ASIO_MOVE_ARG(MoveAcceptHandler) handler
1584 ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
1586 return async_initiate<MoveAcceptHandler,
1588 rebind_executor<executor_type>::other)>(
1589 initiate_async_move_accept(
this), handler,
1590 impl_.get_executor(),
static_cast<endpoint_type*
>(0),
1591 static_cast<typename Protocol::socket::template
1592 rebind_executor<executor_type>::other*
>(0));
1618 template <
typename Executor1>
1620 accept(
const Executor1& ex,
1627 typename Protocol::socket::template
1629 impl_.get_service().accept(impl_.get_implementation(), peer, 0, ec);
1630 asio::detail::throw_error(ec,
"accept");
1657 template <
typename ExecutionContext>
1659 typename ExecutionContext::executor_type>
::other 1660 accept(ExecutionContext& context,
1662 is_convertible<ExecutionContext&, execution_context&>::value
1667 typename ExecutionContext::executor_type>
::other peer(context);
1668 impl_.get_service().accept(impl_.get_implementation(), peer, 0, ec);
1669 asio::detail::throw_error(ec,
"accept");
1701 template <
typename Executor1>
1709 typename Protocol::socket::template
1711 impl_.get_service().accept(impl_.get_implementation(), peer, 0, ec);
1743 template <
typename ExecutionContext>
1745 typename ExecutionContext::executor_type>
::other 1748 is_convertible<ExecutionContext&, execution_context&>::value
1752 typename ExecutionContext::executor_type>
::other peer(context);
1753 impl_.get_service().accept(impl_.get_implementation(), peer, 0, ec);
1799 template <
typename Executor1,
1802 Executor1>::
other)) MoveAcceptHandler
1803 ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
1808 async_accept(
const Executor1& ex,
1809 ASIO_MOVE_ARG(MoveAcceptHandler) handler
1810 ASIO_DEFAULT_COMPLETION_TOKEN(executor_type),
1817 Executor1>
::other other_socket_type;
1819 return async_initiate<MoveAcceptHandler,
1821 initiate_async_move_accept(
this), handler,
1822 ex,
static_cast<endpoint_type*
>(0),
1823 static_cast<other_socket_type*>(0));
1869 template <
typename ExecutionContext,
1872 typename ExecutionContext::executor_type>::
other)) MoveAcceptHandler
1873 ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
1877 typename ExecutionContext::executor_type>::
other))
1878 async_accept(ExecutionContext& context,
1879 ASIO_MOVE_ARG(MoveAcceptHandler) handler
1880 ASIO_DEFAULT_COMPLETION_TOKEN(executor_type),
1882 is_convertible<ExecutionContext&, execution_context&>::value
1886 typename ExecutionContext::executor_type>
::other other_socket_type;
1888 return async_initiate<MoveAcceptHandler,
1890 initiate_async_move_accept(
this), handler,
1891 context.get_executor(),
static_cast<endpoint_type*
>(0),
1892 static_cast<other_socket_type*>(0));
1919 typename Protocol::socket::template rebind_executor<executor_type>::other
1920 accept(endpoint_type& peer_endpoint)
1924 executor_type>
::other peer(impl_.get_executor());
1925 impl_.get_service().accept(impl_.get_implementation(),
1926 peer, &peer_endpoint, ec);
1927 asio::detail::throw_error(ec,
"accept");
1960 typename Protocol::socket::template rebind_executor<executor_type>::other
1964 executor_type>
::other peer(impl_.get_executor());
1965 impl_.get_service().accept(impl_.get_implementation(),
1966 peer, &peer_endpoint, ec);
2020 executor_type>::
other)) MoveAcceptHandler
2021 ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
2024 typename Protocol::socket::template
2025 rebind_executor<executor_type>::other))
2026 async_accept(endpoint_type& peer_endpoint,
2027 ASIO_MOVE_ARG(MoveAcceptHandler) handler
2028 ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
2030 return async_initiate<MoveAcceptHandler,
2032 rebind_executor<executor_type>::other)>(
2033 initiate_async_move_accept(
this), handler,
2034 impl_.get_executor(), &peer_endpoint,
2035 static_cast<typename Protocol::socket::template
2036 rebind_executor<executor_type>::other*
>(0));
2067 template <
typename Executor1>
2069 accept(
const Executor1& ex, endpoint_type& peer_endpoint,
2076 typename Protocol::socket::template
2078 impl_.get_service().accept(impl_.get_implementation(),
2079 peer, &peer_endpoint, ec);
2080 asio::detail::throw_error(ec,
"accept");
2112 template <
typename ExecutionContext>
2114 typename ExecutionContext::executor_type>
::other 2115 accept(ExecutionContext& context, endpoint_type& peer_endpoint,
2117 is_convertible<ExecutionContext&, execution_context&>::value
2122 typename ExecutionContext::executor_type>
::other peer(context);
2123 impl_.get_service().accept(impl_.get_implementation(),
2124 peer, &peer_endpoint, ec);
2125 asio::detail::throw_error(ec,
"accept");
2162 template <
typename Executor1>
2164 accept(
const executor_type& ex,
2171 typename Protocol::socket::template
2173 impl_.get_service().accept(impl_.get_implementation(),
2174 peer, &peer_endpoint, ec);
2211 template <
typename ExecutionContext>
2213 typename ExecutionContext::executor_type>
::other 2214 accept(ExecutionContext& context,
2217 is_convertible<ExecutionContext&, execution_context&>::value
2221 typename ExecutionContext::executor_type>
::other peer(context);
2222 impl_.get_service().accept(impl_.get_implementation(),
2223 peer, &peer_endpoint, ec);
2275 template <
typename Executor1,
2278 Executor1>::
other)) MoveAcceptHandler
2279 ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
2284 async_accept(
const Executor1& ex, endpoint_type& peer_endpoint,
2285 ASIO_MOVE_ARG(MoveAcceptHandler) handler
2286 ASIO_DEFAULT_COMPLETION_TOKEN(executor_type),
2293 Executor1>
::other other_socket_type;
2295 return async_initiate<MoveAcceptHandler,
2297 initiate_async_move_accept(
this), handler,
2299 static_cast<other_socket_type*
>(0));
2351 template <
typename ExecutionContext,
2354 typename ExecutionContext::executor_type>::
other)) MoveAcceptHandler
2355 ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
2359 typename ExecutionContext::executor_type>::
other))
2360 async_accept(ExecutionContext& context,
2361 endpoint_type& peer_endpoint,
2362 ASIO_MOVE_ARG(MoveAcceptHandler) handler
2363 ASIO_DEFAULT_COMPLETION_TOKEN(executor_type),
2365 is_convertible<ExecutionContext&, execution_context&>::value
2369 typename ExecutionContext::executor_type>
::other other_socket_type;
2371 return async_initiate<MoveAcceptHandler,
2373 initiate_async_move_accept(
this), handler,
2374 context.get_executor(), &peer_endpoint,
2375 static_cast<other_socket_type*
>(0));
2377 #endif // defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) 2385 class initiate_async_wait
2397 return self_->get_executor();
2400 template <
typename WaitHandler>
2401 void operator()(ASIO_MOVE_ARG(WaitHandler) handler,
wait_type w)
const 2405 ASIO_WAIT_HANDLER_CHECK(WaitHandler, handler) type_check;
2408 self_->impl_.get_service().async_wait(
2409 self_->impl_.get_implementation(), w,
2410 handler2.value, self_->impl_.get_executor());
2417 class initiate_async_accept
2429 return self_->get_executor();
2432 template <
typename AcceptHandler,
typename Protocol1,
typename Executor1>
2433 void operator()(ASIO_MOVE_ARG(AcceptHandler) handler,
2435 endpoint_type* peer_endpoint)
const 2439 ASIO_ACCEPT_HANDLER_CHECK(AcceptHandler, handler) type_check;
2442 self_->impl_.get_service().async_accept(
2443 self_->impl_.get_implementation(), *peer, peer_endpoint,
2444 handler2.value, self_->impl_.get_executor());
2451 class initiate_async_move_accept
2463 return self_->get_executor();
2466 template <
typename MoveAcceptHandler,
typename Executor1,
typename Socket>
2467 void operator()(ASIO_MOVE_ARG(MoveAcceptHandler) handler,
2468 const Executor1& peer_ex, endpoint_type* peer_endpoint, Socket*)
const 2472 ASIO_MOVE_ACCEPT_HANDLER_CHECK(
2473 MoveAcceptHandler, handler, Socket) type_check;
2476 self_->impl_.get_service().async_move_accept(
2477 self_->impl_.get_implementation(), peer_ex, peer_endpoint,
2478 handler2.value, self_->impl_.get_executor());
2485 #if defined(ASIO_WINDOWS_RUNTIME) 2487 detail::null_socket_service<Protocol>, Executor> impl_;
2488 #elif defined(ASIO_HAS_IOCP) 2490 detail::win_iocp_socket_service<Protocol>, Executor> impl_;
2499 #include "asio/detail/pop_options.hpp" 2501 #endif // ASIO_BASIC_SOCKET_ACCEPTOR_HPP asio::detail::socket_option::boolean< ASIO_OS_DEF(SOL_SOCKET), ASIO_OS_DEF(SO_REUSEADDR)> reuse_address
Socket option to allow the socket to be bound to an address that is already in use.
Definition: socket_base.hpp:396
detail::reactive_socket_service< Protocol >::native_handle_type native_handle_type
The native representation of an acceptor.
Definition: basic_socket_acceptor.hpp:102
void accept(basic_socket< Protocol1, Executor1 > &peer, typename enable_if< is_convertible< Protocol, Protocol1 >::value >::type *=0)
Accept a new connection.
Definition: basic_socket_acceptor.hpp:1254
ASIO_SYNC_OP_VOID set_option(const SettableSocketOption &option, asio::error_code &ec)
Set an option on the acceptor.
Definition: basic_socket_acceptor.hpp:830
basic_socket_acceptor(const executor_type &ex)
Construct an acceptor without opening it.
Definition: basic_socket_acceptor.hpp:121
ASIO_SYNC_OP_VOID non_blocking(bool mode, asio::error_code &ec)
Sets the non-blocking mode of the acceptor.
Definition: basic_socket_acceptor.hpp:1012
void native_non_blocking(bool mode)
Sets the non-blocking mode of the native acceptor implementation.
Definition: basic_socket_acceptor.hpp:1053
basic_socket_acceptor(const executor_type &ex, const protocol_type &protocol)
Construct an open acceptor.
Definition: basic_socket_acceptor.hpp:157
The socket_base class is used as a base for the basic_stream_socket and basic_datagram_socket class t...
Definition: socket_base.hpp:30
void close()
Close the acceptor.
Definition: basic_socket_acceptor.hpp:647
void set_option(const SettableSocketOption &option)
Set an option on the acceptor.
Definition: basic_socket_acceptor.hpp:796
ASIO_SYNC_OP_VOID close(asio::error_code &ec)
Close the acceptor.
Definition: basic_socket_acceptor.hpp:676
Definition: blocking.hpp:208
basic_socket_acceptor(const executor_type &ex, const protocol_type &protocol, const native_handle_type &native_acceptor)
Construct a basic_socket_acceptor on an existing native acceptor.
Definition: basic_socket_acceptor.hpp:305
endpoint_type local_endpoint(asio::error_code &ec) const
Get the local endpoint of the acceptor.
Definition: basic_socket_acceptor.hpp:1130
wait_type
Wait types.
Definition: socket_base.hpp:82
basic_socket_acceptor(ExecutionContext &context, const endpoint_type &endpoint, bool reuse_addr=true, typename enable_if< is_convertible< ExecutionContext &, execution_context &>::value >::type *=0)
Construct an acceptor opened on the given endpoint.
Definition: basic_socket_acceptor.hpp:266
ASIO_INITFN_AUTO_RESULT_TYPE(WaitHandler, void(asio::error_code)) async_wait(wait_type w
Asynchronously wait for the acceptor to become ready to read, ready to write, or to have pending erro...
~basic_socket_acceptor()
Destroys the acceptor.
Definition: basic_socket_acceptor.hpp:435
ASIO_SYNC_OP_VOID open(const protocol_type &protocol, asio::error_code &ec)
Open the acceptor using the specified protocol.
Definition: basic_socket_acceptor.hpp:487
native_handle_type release()
Release ownership of the underlying native acceptor.
Definition: basic_socket_acceptor.hpp:701
basic_socket_acceptor< Protocol, Executor1 > other
The socket type when rebound to the specified executor.
Definition: basic_socket_acceptor.hpp:88
void assign(const protocol_type &protocol, const native_handle_type &native_acceptor)
Assigns an existing native acceptor to the acceptor.
Definition: basic_socket_acceptor.hpp:504
endpoint_type local_endpoint() const
Get the local endpoint of the acceptor.
Definition: basic_socket_acceptor.hpp:1099
ASIO_SYNC_OP_VOID listen(int backlog, asio::error_code &ec)
Place the acceptor into the state where it will listen for new connections.
Definition: basic_socket_acceptor.hpp:631
ASIO_SYNC_OP_VOID bind(const endpoint_type &endpoint, asio::error_code &ec)
Bind the acceptor to the given local endpoint.
Definition: basic_socket_acceptor.hpp:585
basic_socket_acceptor(ExecutionContext &context, const protocol_type &protocol, typename enable_if< is_convertible< ExecutionContext &, execution_context &>::value >::type *=0)
Construct an open acceptor.
Definition: basic_socket_acceptor.hpp:178
Provides the ability to accept new connections.
Definition: basic_socket_acceptor.hpp:51
Executor executor_type
The type of the executor associated with the object.
Definition: basic_socket_acceptor.hpp:81
native_handle_type release(asio::error_code &ec)
Release ownership of the underlying native acceptor.
Definition: basic_socket_acceptor.hpp:729
ASIO_SYNC_OP_VOID native_non_blocking(bool mode, asio::error_code &ec)
Sets the non-blocking mode of the native acceptor implementation.
Definition: basic_socket_acceptor.hpp:1076
void listen(int backlog=socket_base::max_listen_connections)
Place the acceptor into the state where it will listen for new connections.
Definition: basic_socket_acceptor.hpp:602
Rebinds the acceptor type to another executor.
Definition: basic_socket_acceptor.hpp:85
ASIO_SYNC_OP_VOID assign(const protocol_type &protocol, const native_handle_type &native_acceptor, asio::error_code &ec)
Assigns an existing native acceptor to the acceptor.
Definition: basic_socket_acceptor.hpp:523
bool non_blocking() const
Gets the non-blocking mode of the acceptor.
Definition: basic_socket_acceptor.hpp:974
Definition: type_traits.hpp:97
ASIO_SYNC_OP_VOID cancel(asio::error_code &ec)
Cancel all asynchronous operations associated with the acceptor.
Definition: basic_socket_acceptor.hpp:768
Definition: non_const_lvalue.hpp:27
ASIO_SYNC_OP_VOID wait(wait_type w, asio::error_code &ec)
Wait for the acceptor to become ready to read, ready to write, or to have pending error conditions...
Definition: basic_socket_acceptor.hpp:1177
The is_executor trait detects whether a type T meets the Executor type requirements.
Definition: is_executor.hpp:33
void bind(const endpoint_type &endpoint)
Bind the acceptor to the given local endpoint.
Definition: basic_socket_acceptor.hpp:555
native_handle_type native_handle()
Get the native acceptor representation.
Definition: basic_socket_acceptor.hpp:740
basic_socket_acceptor(ExecutionContext &context, const protocol_type &protocol, const native_handle_type &native_acceptor, typename enable_if< is_convertible< ExecutionContext &, execution_context &>::value >::type *=0)
Construct a basic_socket_acceptor on an existing native acceptor.
Definition: basic_socket_acceptor.hpp:331
Protocol::endpoint endpoint_type
The endpoint type.
Definition: basic_socket_acceptor.hpp:109
Class to represent an error code value.
Definition: error_code.hpp:80
Definition: io_object_impl.hpp:33
void wait(wait_type w)
Wait for the acceptor to become ready to read, ready to write, or to have pending error conditions...
Definition: basic_socket_acceptor.hpp:1151
basic_socket_acceptor(const executor_type &ex, const endpoint_type &endpoint, bool reuse_addr=true)
Construct an acceptor opened on the given endpoint.
Definition: basic_socket_acceptor.hpp:217
void cancel()
Cancel all asynchronous operations associated with the acceptor.
Definition: basic_socket_acceptor.hpp:753
Definition: reactive_socket_service.hpp:47
void io_control(IoControlCommand &command)
Perform an IO control command on the acceptor.
Definition: basic_socket_acceptor.hpp:923
void get_option(GettableSocketOption &option) const
Get an option from the acceptor.
Definition: basic_socket_acceptor.hpp:860
bool native_non_blocking() const
Gets the non-blocking mode of the native acceptor implementation.
Definition: basic_socket_acceptor.hpp:1033
Provides socket functionality.
Definition: basic_socket.hpp:52
basic_socket_acceptor(ExecutionContext &context, typename enable_if< is_convertible< ExecutionContext &, execution_context &>::value >::type *=0)
Construct an acceptor without opening it.
Definition: basic_socket_acceptor.hpp:137
ASIO_SYNC_OP_VOID accept(basic_socket< Protocol1, Executor1 > &peer, asio::error_code &ec, typename enable_if< is_convertible< Protocol, Protocol1 >::value >::type *=0)
Accept a new connection.
Definition: basic_socket_acceptor.hpp:1289
ASIO_SYNC_OP_VOID get_option(GettableSocketOption &option, asio::error_code &ec) const
Get an option from the acceptor.
Definition: basic_socket_acceptor.hpp:895
Protocol protocol_type
The protocol type.
Definition: basic_socket_acceptor.hpp:106
void non_blocking(bool mode)
Sets the non-blocking mode of the acceptor.
Definition: basic_socket_acceptor.hpp:992
Definition: any_io_executor.hpp:28
bool is_open() const
Determine whether the acceptor is open.
Definition: basic_socket_acceptor.hpp:532
executor_type get_executor() ASIO_NOEXCEPT
Get the executor associated with the object.
Definition: basic_socket_acceptor.hpp:440
ASIO_SYNC_OP_VOID io_control(IoControlCommand &command, asio::error_code &ec)
Perform an IO control command on the acceptor.
Definition: basic_socket_acceptor.hpp:956
void open(const protocol_type &protocol=protocol_type())
Open the acceptor using the specified protocol.
Definition: basic_socket_acceptor.hpp:460
void assign(int v, const error_category &c)
Assign a new error value.
Definition: error_code.hpp:112
The is_executor trait detects whether a type T satisfies the execution::executor concept.
Definition: executor.hpp:109