ioxx::acceptor< Allocator, Dispatch, Handler > Class Template Reference

Accept incoming stream connections on a local network port. More...

List of all members.

Public Member Functions

 acceptor (dispatch &disp, endpoint const &addr, handler const &f=handler())
 Create an acceptor object.

Detailed Description

template<class Allocator = std::allocator<void>, class Dispatch = dispatch<Allocator>, class Handler = boost::function2< void , typename Dispatch::socket::native_t , typename Dispatch::socket::address const & >>
class ioxx::acceptor< Allocator, Dispatch, Handler >

Accept incoming stream connections on a local network port.

An acceptor is given a socket::endpoint and a handler function. Whenever a new connection is received on that particular endpoint, the acceptor calls the handler function with the newly received socket::native_t and the socket::address of the peer. It's the handler functions responsibility to do something with the socket, i.e. to register it in an event dispatcher. If the handler function throws an exception, however, the newly received socket is closed before the exception is propagated.

See also:
Example inet daemon

Constructor & Destructor Documentation

template<class Allocator = std::allocator<void>, class Dispatch = dispatch<Allocator>, class Handler = boost::function2< void , typename Dispatch::socket::native_t , typename Dispatch::socket::address const & >>
ioxx::acceptor< Allocator, Dispatch, Handler >::acceptor ( dispatch &  disp,
endpoint const &  addr,
handler const &  f = handler() 
)

Create an acceptor object.

Parameters:
disp The i/o event dispatcher (i.e. core) to register this acceptor in.
addr Create a listening socket that's bound to this particular endpoint.
f Callback function to invoke every time new connection is received.
Generated on Mon Mar 1 18:42:38 2010 for ioxx by  doxygen 1.6.3