Accept incoming stream connections on a local network port. More...
Public Member Functions | |
acceptor (dispatch &disp, endpoint const &addr, handler const &f=handler()) | |
Create an acceptor object. |
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.
ioxx::acceptor< Allocator, Dispatch, Handler >::acceptor | ( | dispatch & | disp, | |
endpoint const & | addr, | |||
handler const & | f = handler() | |||
) |
Create an acceptor object.
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. |