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) 52 template <
typename Protocol,
53 typename SocketAcceptorService = socket_acceptor_service<Protocol> >
61 typedef typename SocketAcceptorService::native_handle_type
native_type;
100 const protocol_type& protocol)
136 const endpoint_type& endpoint,
bool reuse_addr =
true)
140 const protocol_type protocol = endpoint.protocol();
152 socket_base::max_connections, ec);
172 const protocol_type& protocol,
const native_handle_type& native_acceptor)
177 protocol, native_acceptor, ec);
181 #if defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) 216 template <
typename Protocol1,
typename SocketAcceptorService1>
230 template <
typename Protocol1,
typename SocketAcceptorService1>
233 typename enable_if<is_convertible<Protocol1, Protocol>::value>::type* = 0)
236 this->
get_service().template converting_move_construct<Protocol1>(
251 template <
typename Protocol1,
typename SocketAcceptorService1>
257 Protocol1, SocketAcceptorService1>)(other));
262 #endif // defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) 322 void assign(
const protocol_type& protocol,
323 const native_handle_type& native_acceptor)
327 protocol, native_acceptor, ec);
345 protocol, native_acceptor, ec);
372 void bind(
const endpoint_type& endpoint)
418 void listen(
int backlog = socket_base::max_connections)
567 template <
typename SettableSocketOption>
601 template <
typename SettableSocketOption>
631 template <
typename GettableSocketOption>
666 template <
typename GettableSocketOption>
694 template <
typename IoControlCommand>
727 template <
typename IoControlCommand>
873 endpoint_type ep = this->
get_service().local_endpoint(
924 template <
typename Protocol1,
typename SocketService>
926 typename enable_if<is_convertible<Protocol, Protocol1>::value>::type* = 0)
930 peer, static_cast<endpoint_type*>(0), ec);
957 template <
typename Protocol1,
typename SocketService>
961 typename enable_if<is_convertible<Protocol, Protocol1>::value>::type* = 0)
964 peer, static_cast<endpoint_type*>(0), ec);
1005 template <
typename Protocol1,
typename SocketService,
typename AcceptHandler>
1010 typename
enable_if<is_convertible<Protocol, Protocol1>::value>::type* = 0)
1017 peer, static_cast<endpoint_type*>(0),
1044 template <
typename SocketService>
1050 peer, &peer_endpoint, ec);
1082 template <
typename SocketService>
1117 template <
typename SocketService,
typename AcceptHandler>
1136 #endif // ASIO_BASIC_SOCKET_ACCEPTOR_HPP
void throw_error(const asio::error_code &err)
basic_socket_acceptor(asio::io_service &io_service, const protocol_type &protocol, const native_handle_type &native_acceptor)
Construct a basic_socket_acceptor on an existing native acceptor.
SocketAcceptorService::native_handle_type native_handle_type
The native representation of an acceptor.
asio::error_code assign(const protocol_type &protocol, const native_handle_type &native_acceptor, asio::error_code &ec)
Assigns an existing native acceptor to the acceptor.
Provides core I/O functionality.
service_type & get_service()
Get the service associated with the I/O object.
#define ASIO_MOVE_CAST2(type1, type2)
SocketService enable_if< is_convertible< Protocol, Protocol1 >::value >::type AcceptHandler SocketService endpoint_type & peer_endpoint
void close()
Close the acceptor.
SocketService ASIO_MOVE_ARG(AcceptHandler) handler
basic_socket_acceptor(asio::io_service &io_service, const endpoint_type &endpoint, bool reuse_addr=true)
Construct an acceptor opened on the given endpoint.
endpoint_type local_endpoint() const
Get the local endpoint of the acceptor.
Base class for all I/O objects.
void native_non_blocking(bool mode)
Sets the non-blocking mode of the native acceptor implementation.
void cancel()
Cancel all asynchronous operations associated with the acceptor.
asio::error_code open(const protocol_type &protocol, asio::error_code &ec)
Open the acceptor using the specified protocol.
asio::error_code bind(const endpoint_type &endpoint, asio::error_code &ec)
Bind the acceptor to the given local endpoint.
asio::error_code non_blocking(bool mode, asio::error_code &ec)
Sets the non-blocking mode of the acceptor.
void bind(const endpoint_type &endpoint)
Bind the acceptor to the given local endpoint.
asio::error_code accept(basic_socket< Protocol1, SocketService > &peer, asio::error_code &ec, typename enable_if< is_convertible< Protocol, Protocol1 >::value >::type *=0)
Accept a new connection.
Provides the ability to accept new connections.
void open(const protocol_type &protocol=protocol_type())
Open the acceptor using the specified protocol.
void accept(basic_socket< Protocol1, SocketService > &peer, typename enable_if< is_convertible< Protocol, Protocol1 >::value >::type *=0)
Accept a new connection.
Protocol protocol_type
The protocol type.
#define ASIO_ACCEPT_HANDLER_CHECK(handler_type, handler)
asio::error_code cancel(asio::error_code &ec)
Cancel all asynchronous operations associated with the acceptor.
void get_option(GettableSocketOption &option)
Get an option from the acceptor.
native_type native()
(Deprecated: Use native_handle().) Get the native acceptor representation.
implementation_type & get_implementation()
Get the underlying implementation of the I/O object.
asio::error_code io_control(IoControlCommand &command, asio::error_code &ec)
Perform an IO control command on the acceptor.
Class to represent an error code value.
SocketAcceptorService::native_handle_type native_type
native_handle_type native_handle()
Get the native acceptor representation.
ASIO_INITFN_RESULT_TYPE(AcceptHandler, void(asio::error_code)) async_accept(basic_socket< Protocol1
Start an asynchronous accept.
asio::error_code set_option(const SettableSocketOption &option, asio::error_code &ec)
Set an option on the acceptor.
endpoint_type local_endpoint(asio::error_code &ec) const
Get the local endpoint of the acceptor.
asio::error_code close(asio::error_code &ec)
Close the acceptor.
asio::error_code get_option(GettableSocketOption &option, asio::error_code &ec)
Get an option from the acceptor.
basic_socket_acceptor(asio::io_service &io_service, const protocol_type &protocol)
Construct an open acceptor.
asio::error_code native_non_blocking(bool mode, asio::error_code &ec)
Sets the non-blocking mode of the native acceptor implementation.
void listen(int backlog=socket_base::max_connections)
#define ASIO_MOVE_CAST(type)
void set_option(const SettableSocketOption &option)
Set an option on the acceptor.
void io_control(IoControlCommand &command)
Perform an IO control command on the acceptor.
basic_socket_acceptor(asio::io_service &io_service)
Construct an acceptor without opening it.
void assign(const protocol_type &protocol, const native_handle_type &native_acceptor)
Assigns an existing native acceptor to the acceptor.
Protocol::endpoint endpoint_type
The endpoint type.
asio::error_code listen(int backlog, asio::error_code &ec)
void non_blocking(bool mode)
Sets the non-blocking mode of the acceptor.
bool native_non_blocking() const
Gets the non-blocking mode of the native acceptor implementation.
bool non_blocking() const
Gets the non-blocking mode of the acceptor.
bool is_open() const
Determine whether the acceptor is open.