##### basic_socket_acceptor::async_accept (7 of 8 overloads)

Start an asynchronous accept.

    template<
        typename Executor1,
        typename MoveAcceptHandler = DEFAULT>
    DEDUCED async_accept(
        const Executor1 & ex,
        endpoint_type & peer_endpoint,
        MoveAcceptHandler && handler = DEFAULT,
        typename enable_if< is_executor< Executor1 >::value||execution::is_executor< Executor1 >::value >::type *  = 0);

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

This overload requires that the Protocol template parameter satisfy the AcceptableProtocol type requirements.

###### Parameters

ex

  The I/O executor object to be used for the newly accepted socket.

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.
        typename Protocol::socket::template rebind_executor<
          Executor1>::other peer // On success, the newly accepted socket.
      );

  Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. On immediate completion, invocation of the handler will be performed in a manner equivalent to using `post`.

###### Example

    void accept_handler(const asio::error_code& error,
        asio::ip::tcp::socket peer)
    {
      if (!error)
      {
        // Accept succeeded.
      }
    }

    ...

    asio::ip::tcp::acceptor acceptor(my_context);
    ...
    asio::ip::tcp::endpoint endpoint;
    acceptor.async_accept(my_context2, endpoint, accept_handler);