$search

asio::basic_socket_acceptor< Protocol, SocketAcceptorService > Class Template Reference

Provides the ability to accept new connections. More...

#include <basic_socket_acceptor.hpp>

Inheritance diagram for asio::basic_socket_acceptor< Protocol, SocketAcceptorService >:
Inheritance graph
[legend]

List of all members.

Public Types

typedef Protocol::endpoint endpoint_type
 The endpoint type.
typedef
SocketAcceptorService::native_type 
native_type
 The native representation of an acceptor.
typedef Protocol protocol_type
 The protocol type.

Public Member Functions

template<typename SocketService >
asio::error_code accept (basic_socket< protocol_type, SocketService > &peer, endpoint_type &peer_endpoint, asio::error_code &ec)
 Accept a new connection and obtain the endpoint of the peer.
template<typename SocketService >
void accept (basic_socket< protocol_type, SocketService > &peer, endpoint_type &peer_endpoint)
 Accept a new connection and obtain the endpoint of the peer.
template<typename SocketService >
asio::error_code accept (basic_socket< protocol_type, SocketService > &peer, asio::error_code &ec)
 Accept a new connection.
template<typename SocketService >
void accept (basic_socket< protocol_type, SocketService > &peer)
 Accept a new connection.
asio::error_code assign (const protocol_type &protocol, const native_type &native_acceptor, asio::error_code &ec)
 Assigns an existing native acceptor to the acceptor.
void assign (const protocol_type &protocol, const native_type &native_acceptor)
 Assigns an existing native acceptor to the acceptor.
template<typename SocketService , typename AcceptHandler >
void async_accept (basic_socket< protocol_type, SocketService > &peer, endpoint_type &peer_endpoint, AcceptHandler handler)
 Start an asynchronous accept.
template<typename SocketService , typename AcceptHandler >
void async_accept (basic_socket< protocol_type, SocketService > &peer, AcceptHandler handler)
 Start an asynchronous accept.
 basic_socket_acceptor (asio::io_service &io_service, const protocol_type &protocol, const native_type &native_acceptor)
 Construct a basic_socket_acceptor on an existing native acceptor.
 basic_socket_acceptor (asio::io_service &io_service, const endpoint_type &endpoint, bool reuse_addr=true)
 Construct an acceptor opened on the given endpoint.
 basic_socket_acceptor (asio::io_service &io_service, const protocol_type &protocol)
 Construct an open acceptor.
 basic_socket_acceptor (asio::io_service &io_service)
 Construct an acceptor without opening it.
asio::error_code bind (const endpoint_type &endpoint, asio::error_code &ec)
 Bind the acceptor to the given local endpoint.
void bind (const endpoint_type &endpoint)
 Bind the acceptor to the given local endpoint.
asio::error_code cancel (asio::error_code &ec)
 Cancel all asynchronous operations associated with the acceptor.
void cancel ()
 Cancel all asynchronous operations associated with the acceptor.
asio::error_code close (asio::error_code &ec)
 Close the acceptor.
void close ()
 Close the acceptor.
template<typename GettableSocketOption >
asio::error_code get_option (GettableSocketOption &option, asio::error_code &ec)
 Get an option from the acceptor.
template<typename GettableSocketOption >
void get_option (GettableSocketOption &option)
 Get an option from the acceptor.
bool is_open () const
 Determine whether the acceptor is open.
asio::error_code listen (int backlog, asio::error_code &ec)
void listen (int backlog=socket_base::max_connections)
endpoint_type local_endpoint (asio::error_code &ec) const
 Get the local endpoint of the acceptor.
endpoint_type local_endpoint () const
 Get the local endpoint of the acceptor.
native_type native ()
 Get the native acceptor representation.
asio::error_code open (const protocol_type &protocol, asio::error_code &ec)
 Open the acceptor using the specified protocol.
void open (const protocol_type &protocol=protocol_type())
 Open the acceptor using the specified protocol.
template<typename SettableSocketOption >
asio::error_code set_option (const SettableSocketOption &option, asio::error_code &ec)
 Set an option on the acceptor.
template<typename SettableSocketOption >
void set_option (const SettableSocketOption &option)
 Set an option on the acceptor.

Detailed Description

template<typename Protocol, typename SocketAcceptorService = socket_acceptor_service<Protocol>>
class asio::basic_socket_acceptor< Protocol, SocketAcceptorService >

Provides the ability to accept new connections.

The basic_socket_acceptor class template is used for accepting new socket connections.

Thread Safety
Distinct objects: Safe.
Shared objects: Unsafe.
Example
Opening a socket acceptor with the SO_REUSEADDR option enabled:
 asio::ip::tcp::acceptor acceptor(io_service);
 asio::ip::tcp::endpoint endpoint(asio::ip::tcp::v4(), port);
 acceptor.open(endpoint.protocol());
 acceptor.set_option(asio::ip::tcp::acceptor::reuse_address(true));
 acceptor.bind(endpoint);
 acceptor.listen();

Definition at line 51 of file basic_socket_acceptor.hpp.


Member Typedef Documentation

template<typename Protocol , typename SocketAcceptorService = socket_acceptor_service<Protocol>>
typedef Protocol::endpoint asio::basic_socket_acceptor< Protocol, SocketAcceptorService >::endpoint_type

The endpoint type.

Definition at line 63 of file basic_socket_acceptor.hpp.

template<typename Protocol , typename SocketAcceptorService = socket_acceptor_service<Protocol>>
typedef SocketAcceptorService::native_type asio::basic_socket_acceptor< Protocol, SocketAcceptorService >::native_type

The native representation of an acceptor.

Definition at line 57 of file basic_socket_acceptor.hpp.

template<typename Protocol , typename SocketAcceptorService = socket_acceptor_service<Protocol>>
typedef Protocol asio::basic_socket_acceptor< Protocol, SocketAcceptorService >::protocol_type

The protocol type.

Definition at line 60 of file basic_socket_acceptor.hpp.


Constructor & Destructor Documentation

template<typename Protocol , typename SocketAcceptorService = socket_acceptor_service<Protocol>>
asio::basic_socket_acceptor< Protocol, SocketAcceptorService >::basic_socket_acceptor ( asio::io_service io_service  )  [inline, explicit]

Construct an acceptor without opening it.

This constructor creates an acceptor without opening it to listen for new connections. The open() function must be called before the acceptor can accept new socket connections.

Parameters:
io_service The io_service object that the acceptor will use to dispatch handlers for any asynchronous operations performed on the acceptor.

Definition at line 75 of file basic_socket_acceptor.hpp.

template<typename Protocol , typename SocketAcceptorService = socket_acceptor_service<Protocol>>
asio::basic_socket_acceptor< Protocol, SocketAcceptorService >::basic_socket_acceptor ( asio::io_service io_service,
const protocol_type protocol 
) [inline]

Construct an open acceptor.

This constructor creates an acceptor and automatically opens it.

Parameters:
io_service The io_service object that the acceptor will use to dispatch handlers for any asynchronous operations performed on the acceptor.
protocol An object specifying protocol parameters to be used.
Exceptions:
asio::system_error Thrown on failure.

Definition at line 92 of file basic_socket_acceptor.hpp.

template<typename Protocol , typename SocketAcceptorService = socket_acceptor_service<Protocol>>
asio::basic_socket_acceptor< Protocol, SocketAcceptorService >::basic_socket_acceptor ( asio::io_service io_service,
const endpoint_type endpoint,
bool  reuse_addr = true 
) [inline]

Construct an acceptor opened on the given endpoint.

This constructor creates an acceptor and automatically opens it to listen for new connections on the specified endpoint.

Parameters:
io_service The io_service object that the acceptor will use to dispatch handlers for any asynchronous operations performed on the acceptor.
endpoint An endpoint on the local machine on which the acceptor will listen for new connections.
reuse_addr Whether the constructor should set the socket option socket_base::reuse_address.
Exceptions:
asio::system_error Thrown on failure.
Note:
This constructor is equivalent to the following code:
 basic_socket_acceptor<Protocol> acceptor(io_service);
 acceptor.open(endpoint.protocol());
 if (reuse_addr)
   acceptor.set_option(socket_base::reuse_address(true));
 acceptor.bind(endpoint);
 acceptor.listen(listen_backlog);

Definition at line 128 of file basic_socket_acceptor.hpp.

template<typename Protocol , typename SocketAcceptorService = socket_acceptor_service<Protocol>>
asio::basic_socket_acceptor< Protocol, SocketAcceptorService >::basic_socket_acceptor ( asio::io_service io_service,
const protocol_type protocol,
const native_type native_acceptor 
) [inline]

Construct a basic_socket_acceptor on an existing native acceptor.

This constructor creates an acceptor object to hold an existing native acceptor.

Parameters:
io_service The io_service object that the acceptor will use to dispatch handlers for any asynchronous operations performed on the acceptor.
protocol An object specifying protocol parameters to be used.
native_acceptor A native acceptor.
Exceptions:
asio::system_error Thrown on failure.

Definition at line 163 of file basic_socket_acceptor.hpp.


Member Function Documentation

template<typename Protocol , typename SocketAcceptorService = socket_acceptor_service<Protocol>>
template<typename SocketService >
asio::error_code asio::basic_socket_acceptor< Protocol, SocketAcceptorService >::accept ( basic_socket< protocol_type, SocketService > &  peer,
endpoint_type peer_endpoint,
asio::error_code ec 
) [inline]

Accept a new connection and obtain the endpoint of the peer.

This function is used to accept a new connection from a peer into the given socket, and additionally provide the endpoint of the remote peer. The function call will block until a new connection has been accepted successfully or an error occurs.

Parameters:
peer The socket into which the new connection will be accepted.
peer_endpoint An endpoint object which will receive the endpoint of the remote peer.
ec Set to indicate what error occurred, if any.
Example
 asio::ip::tcp::acceptor acceptor(io_service);
 ...
 asio::ip::tcp::socket socket(io_service);
 asio::ip::tcp::endpoint endpoint;
 asio::error_code ec;
 acceptor.accept(socket, endpoint, ec);
 if (ec)
 {
   // An error occurred.
 }

Definition at line 778 of file basic_socket_acceptor.hpp.

template<typename Protocol , typename SocketAcceptorService = socket_acceptor_service<Protocol>>
template<typename SocketService >
void asio::basic_socket_acceptor< Protocol, SocketAcceptorService >::accept ( basic_socket< protocol_type, SocketService > &  peer,
endpoint_type peer_endpoint 
) [inline]

Accept a new connection and obtain the endpoint of the peer.

This function is used to accept a new connection from a peer into the given socket, and additionally provide the endpoint of the remote peer. The function call will block until a new connection has been accepted successfully or an error occurs.

Parameters:
peer The socket into which the new connection will be accepted.
peer_endpoint An endpoint object which will receive the endpoint of the remote peer.
Exceptions:
asio::system_error Thrown on failure.
Example

Definition at line 741 of file basic_socket_acceptor.hpp.

template<typename Protocol , typename SocketAcceptorService = socket_acceptor_service<Protocol>>
template<typename SocketService >
asio::error_code asio::basic_socket_acceptor< Protocol, SocketAcceptorService >::accept ( basic_socket< protocol_type, SocketService > &  peer,
asio::error_code ec 
) [inline]

Accept a new connection.

This function is used to accept a new connection from a peer into the given socket. The function call will block until a new connection has been accepted successfully or an error occurs.

Parameters:
peer The socket into which the new connection will be accepted.
ec Set to indicate what error occurred, if any.
Example
 asio::ip::tcp::acceptor acceptor(io_service);
 ...
 asio::ip::tcp::soocket socket(io_service);
 asio::error_code ec;
 acceptor.accept(socket, ec);
 if (ec)
 {
   // An error occurred.
 }

Definition at line 665 of file basic_socket_acceptor.hpp.

template<typename Protocol , typename SocketAcceptorService = socket_acceptor_service<Protocol>>
template<typename SocketService >
void asio::basic_socket_acceptor< Protocol, SocketAcceptorService >::accept ( basic_socket< protocol_type, SocketService > &  peer  )  [inline]

Accept a new connection.

This function is used to accept a new connection from a peer into the given socket. The function call will block until a new connection has been accepted successfully or an error occurs.

Parameters:
peer The socket into which the new connection will be accepted.
Exceptions:
asio::system_error Thrown on failure.
Example

Definition at line 634 of file basic_socket_acceptor.hpp.

template<typename Protocol , typename SocketAcceptorService = socket_acceptor_service<Protocol>>
asio::error_code asio::basic_socket_acceptor< Protocol, SocketAcceptorService >::assign ( const protocol_type protocol,
const native_type native_acceptor,
asio::error_code ec 
) [inline]

Assigns an existing native acceptor to the acceptor.

Definition at line 247 of file basic_socket_acceptor.hpp.

template<typename Protocol , typename SocketAcceptorService = socket_acceptor_service<Protocol>>
void asio::basic_socket_acceptor< Protocol, SocketAcceptorService >::assign ( const protocol_type protocol,
const native_type native_acceptor 
) [inline]

Assigns an existing native acceptor to the acceptor.

Definition at line 230 of file basic_socket_acceptor.hpp.

template<typename Protocol , typename SocketAcceptorService = socket_acceptor_service<Protocol>>
template<typename SocketService , typename AcceptHandler >
void asio::basic_socket_acceptor< Protocol, SocketAcceptorService >::async_accept ( basic_socket< protocol_type, SocketService > &  peer,
endpoint_type peer_endpoint,
AcceptHandler  handler 
) [inline]

Start an asynchronous accept.

This function is used to asynchronously accept a new connection into a socket, and additionally obtain the endpoint of the remote peer. The function call always returns immediately.

Parameters:
peer The socket into which the new connection will be accepted. Ownership of the peer object is retained by the caller, which must guarantee that it is valid until the handler is called.
peer_endpoint An endpoint object into which the endpoint of the remote peer will be written. Ownership of the peer_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 accept operation completes. Copies will be made of the handler as required. The function signature of the handler must be:

 void handler(
   const asio::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 asio::io_service::post().

Definition at line 812 of file basic_socket_acceptor.hpp.

template<typename Protocol , typename SocketAcceptorService = socket_acceptor_service<Protocol>>
template<typename SocketService , typename AcceptHandler >
void asio::basic_socket_acceptor< Protocol, SocketAcceptorService >::async_accept ( basic_socket< protocol_type, SocketService > &  peer,
AcceptHandler  handler 
) [inline]

Start an asynchronous accept.

This function is used to asynchronously accept a new connection into a socket. The function call always returns immediately.

Parameters:
peer The socket into which the new connection will be accepted. Ownership of the peer 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 accept operation completes. Copies will be made of the handler as required. The function signature of the handler must be:

 void handler(
   const asio::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 asio::io_service::post().

Example
 void accept_handler(const asio::error_code& error)
 {
   if (!error)
   {
     // Accept succeeded.
   }
 }

 ...

 asio::ip::tcp::acceptor acceptor(io_service);
 ...
 asio::ip::tcp::socket socket(io_service);
 acceptor.async_accept(socket, accept_handler);

Definition at line 711 of file basic_socket_acceptor.hpp.

template<typename Protocol , typename SocketAcceptorService = socket_acceptor_service<Protocol>>
asio::error_code asio::basic_socket_acceptor< Protocol, SocketAcceptorService >::bind ( const endpoint_type endpoint,
asio::error_code ec 
) [inline]

Bind the acceptor to the given local endpoint.

This function binds the socket acceptor to the specified endpoint on the local machine.

Parameters:
endpoint An endpoint on the local machine to which the socket acceptor will be bound.
ec Set to indicate what error occurred, if any.
Example
 asio::ip::tcp::acceptor acceptor(io_service);
 acceptor.open(asio::ip::tcp::v4());
 asio::error_code ec;
 acceptor.bind(asio::ip::tcp::endpoint(12345), ec);
 if (ec)
 {
   // An error occurred.
 }

Definition at line 306 of file basic_socket_acceptor.hpp.

template<typename Protocol , typename SocketAcceptorService = socket_acceptor_service<Protocol>>
void asio::basic_socket_acceptor< Protocol, SocketAcceptorService >::bind ( const endpoint_type endpoint  )  [inline]

Bind the acceptor to the given local endpoint.

This function binds the socket acceptor to the specified endpoint on the local machine.

Parameters:
endpoint An endpoint on the local machine to which the socket acceptor will be bound.
Exceptions:
asio::system_error Thrown on failure.
Example
 asio::ip::tcp::acceptor acceptor(io_service);
 acceptor.open(asio::ip::tcp::v4());
 acceptor.bind(asio::ip::tcp::endpoint(12345));

Definition at line 277 of file basic_socket_acceptor.hpp.

template<typename Protocol , typename SocketAcceptorService = socket_acceptor_service<Protocol>>
asio::error_code asio::basic_socket_acceptor< Protocol, SocketAcceptorService >::cancel ( asio::error_code ec  )  [inline]

Cancel all asynchronous operations associated with the acceptor.

This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the asio::error::operation_aborted error.

Parameters:
ec Set to indicate what error occurred, if any.

Definition at line 434 of file basic_socket_acceptor.hpp.

template<typename Protocol , typename SocketAcceptorService = socket_acceptor_service<Protocol>>
void asio::basic_socket_acceptor< Protocol, SocketAcceptorService >::cancel (  )  [inline]

Cancel all asynchronous operations associated with the acceptor.

This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the asio::error::operation_aborted error.

Exceptions:
asio::system_error Thrown on failure.

Definition at line 419 of file basic_socket_acceptor.hpp.

template<typename Protocol , typename SocketAcceptorService = socket_acceptor_service<Protocol>>
asio::error_code asio::basic_socket_acceptor< Protocol, SocketAcceptorService >::close ( asio::error_code ec  )  [inline]

Close the acceptor.

This function is used to close the acceptor. Any asynchronous accept operations will be cancelled immediately.

A subsequent call to open() is required before the acceptor can again be used to again perform socket accept operations.

Parameters:
ec Set to indicate what error occurred, if any.
Example
 asio::ip::tcp::acceptor acceptor(io_service);
 ...
 asio::error_code ec;
 acceptor.close(ec);
 if (ec)
 {
   // An error occurred.
 }

Definition at line 395 of file basic_socket_acceptor.hpp.

template<typename Protocol , typename SocketAcceptorService = socket_acceptor_service<Protocol>>
void asio::basic_socket_acceptor< Protocol, SocketAcceptorService >::close (  )  [inline]

Close the acceptor.

This function is used to close the acceptor. Any asynchronous accept operations will be cancelled immediately.

A subsequent call to open() is required before the acceptor can again be used to again perform socket accept operations.

Exceptions:
asio::system_error Thrown on failure.

Definition at line 366 of file basic_socket_acceptor.hpp.

template<typename Protocol , typename SocketAcceptorService = socket_acceptor_service<Protocol>>
template<typename GettableSocketOption >
asio::error_code asio::basic_socket_acceptor< Protocol, SocketAcceptorService >::get_option ( GettableSocketOption &  option,
asio::error_code ec 
) [inline]

Get an option from the acceptor.

This function is used to get the current value of an option on the acceptor.

Parameters:
option The option value to be obtained from the acceptor.
ec Set to indicate what error occurred, if any.
See also:
GettableSocketOption
asio::socket_base::reuse_address
Example
Getting the value of the SOL_SOCKET/SO_REUSEADDR option:
 asio::ip::tcp::acceptor acceptor(io_service);
 ...
 asio::ip::tcp::acceptor::reuse_address option;
 asio::error_code ec;
 acceptor.get_option(option, ec);
 if (ec)
 {
   // An error occurred.
 }
 bool is_set = option.get();

Definition at line 559 of file basic_socket_acceptor.hpp.

template<typename Protocol , typename SocketAcceptorService = socket_acceptor_service<Protocol>>
template<typename GettableSocketOption >
void asio::basic_socket_acceptor< Protocol, SocketAcceptorService >::get_option ( GettableSocketOption &  option  )  [inline]

Get an option from the acceptor.

This function is used to get the current value of an option on the acceptor.

Parameters:
option The option value to be obtained from the acceptor.
Exceptions:
asio::system_error Thrown on failure.
See also:
GettableSocketOption
asio::socket_base::reuse_address
Example
Getting the value of the SOL_SOCKET/SO_REUSEADDR option:
 asio::ip::tcp::acceptor acceptor(io_service);
 ...
 asio::ip::tcp::acceptor::reuse_address option;
 acceptor.get_option(option);
 bool is_set = option.get();

Definition at line 524 of file basic_socket_acceptor.hpp.

template<typename Protocol , typename SocketAcceptorService = socket_acceptor_service<Protocol>>
bool asio::basic_socket_acceptor< Protocol, SocketAcceptorService >::is_open (  )  const [inline]

Determine whether the acceptor is open.

Definition at line 255 of file basic_socket_acceptor.hpp.

template<typename Protocol , typename SocketAcceptorService = socket_acceptor_service<Protocol>>
asio::error_code asio::basic_socket_acceptor< Protocol, SocketAcceptorService >::listen ( int  backlog,
asio::error_code ec 
) [inline]

Place the acceptor into the state where it will listen for new connections. This function puts the socket acceptor into the state where it may accept new connections.

Parameters:
backlog The maximum length of the queue of pending connections.
ec Set to indicate what error occurred, if any.
Example
 asio::ip::tcp::acceptor acceptor(io_service);
 ...
 asio::error_code ec;
 acceptor.listen(asio::socket_base::max_connections, ec);
 if (ec)
 {
   // An error occurred.
 }

Definition at line 351 of file basic_socket_acceptor.hpp.

template<typename Protocol , typename SocketAcceptorService = socket_acceptor_service<Protocol>>
void asio::basic_socket_acceptor< Protocol, SocketAcceptorService >::listen ( int  backlog = socket_base::max_connections  )  [inline]

Place the acceptor into the state where it will listen for new connections. This function puts the socket acceptor into the state where it may accept new connections.

Parameters:
backlog The maximum length of the queue of pending connections.
Exceptions:
asio::system_error Thrown on failure.

Definition at line 322 of file basic_socket_acceptor.hpp.

template<typename Protocol , typename SocketAcceptorService = socket_acceptor_service<Protocol>>
endpoint_type asio::basic_socket_acceptor< Protocol, SocketAcceptorService >::local_endpoint ( asio::error_code ec  )  const [inline]

Get the local endpoint of the acceptor.

This function is used to obtain the locally bound endpoint of the acceptor.

Parameters:
ec Set to indicate what error occurred, if any.
Returns:
An object that represents the local endpoint of the acceptor. Returns a default-constructed endpoint object if an error occurred and the error handler did not throw an exception.
Example
 asio::ip::tcp::acceptor acceptor(io_service);
 ...
 asio::error_code ec;
 asio::ip::tcp::endpoint endpoint = acceptor.local_endpoint(ec);
 if (ec)
 {
   // An error occurred.
 }

Definition at line 610 of file basic_socket_acceptor.hpp.

template<typename Protocol , typename SocketAcceptorService = socket_acceptor_service<Protocol>>
endpoint_type asio::basic_socket_acceptor< Protocol, SocketAcceptorService >::local_endpoint (  )  const [inline]

Get the local endpoint of the acceptor.

This function is used to obtain the locally bound endpoint of the acceptor.

Returns:
An object that represents the local endpoint of the acceptor.
Exceptions:
asio::system_error Thrown on failure.
Example
 asio::ip::tcp::acceptor acceptor(io_service);
 ...
 asio::ip::tcp::endpoint endpoint = acceptor.local_endpoint();

Definition at line 580 of file basic_socket_acceptor.hpp.

template<typename Protocol , typename SocketAcceptorService = socket_acceptor_service<Protocol>>
native_type asio::basic_socket_acceptor< Protocol, SocketAcceptorService >::native (  )  [inline]

Get the native acceptor representation.

This function may be used to obtain the underlying representation of the acceptor. This is intended to allow access to native acceptor functionality that is not otherwise provided.

Definition at line 406 of file basic_socket_acceptor.hpp.

template<typename Protocol , typename SocketAcceptorService = socket_acceptor_service<Protocol>>
asio::error_code asio::basic_socket_acceptor< Protocol, SocketAcceptorService >::open ( const protocol_type protocol,
asio::error_code ec 
) [inline]

Open the acceptor using the specified protocol.

This function opens the socket acceptor so that it will use the specified protocol.

Parameters:
protocol An object specifying which protocol is to be used.
ec Set to indicate what error occurred, if any.
Example
 asio::ip::tcp::acceptor acceptor(io_service);
 asio::error_code ec;
 acceptor.open(asio::ip::tcp::v4(), ec);
 if (ec)
 {
   // An error occurred.
 }

Definition at line 214 of file basic_socket_acceptor.hpp.

template<typename Protocol , typename SocketAcceptorService = socket_acceptor_service<Protocol>>
void asio::basic_socket_acceptor< Protocol, SocketAcceptorService >::open ( const protocol_type protocol = protocol_type()  )  [inline]

Open the acceptor using the specified protocol.

This function opens the socket acceptor so that it will use the specified protocol.

Parameters:
protocol An object specifying which protocol is to be used.
Exceptions:
asio::system_error Thrown on failure.
Example

Definition at line 187 of file basic_socket_acceptor.hpp.

template<typename Protocol , typename SocketAcceptorService = socket_acceptor_service<Protocol>>
template<typename SettableSocketOption >
asio::error_code asio::basic_socket_acceptor< Protocol, SocketAcceptorService >::set_option ( const SettableSocketOption &  option,
asio::error_code ec 
) [inline]

Set an option on the acceptor.

This function is used to set an option on the acceptor.

Parameters:
option The new option value to be set on the acceptor.
ec Set to indicate what error occurred, if any.
See also:
SettableSocketOption
asio::socket_base::reuse_address asio::socket_base::enable_connection_aborted
Example
Setting the SOL_SOCKET/SO_REUSEADDR option:
 asio::ip::tcp::acceptor acceptor(io_service);
 ...
 asio::ip::tcp::acceptor::reuse_address option(true);
 asio::error_code ec;
 acceptor.set_option(option, ec);
 if (ec)
 {
   // An error occurred.
 }

Definition at line 495 of file basic_socket_acceptor.hpp.

template<typename Protocol , typename SocketAcceptorService = socket_acceptor_service<Protocol>>
template<typename SettableSocketOption >
void asio::basic_socket_acceptor< Protocol, SocketAcceptorService >::set_option ( const SettableSocketOption &  option  )  [inline]

Set an option on the acceptor.

This function is used to set an option on the acceptor.

Parameters:
option The new option value to be set on the acceptor.
Exceptions:
asio::system_error Thrown on failure.
See also:
SettableSocketOption
asio::socket_base::reuse_address asio::socket_base::enable_connection_aborted
Example
Setting the SOL_SOCKET/SO_REUSEADDR option:
 asio::ip::tcp::acceptor acceptor(io_service);
 ...
 asio::ip::tcp::acceptor::reuse_address option(true);
 acceptor.set_option(option);

Definition at line 461 of file basic_socket_acceptor.hpp.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


Castor
Author(s): Carpe Noctem
autogenerated on Fri Mar 1 14:41:41 2013