Exemplo n.º 1
0
    explicit basic_request_acceptor(
          common::basic_protocol_service<protocol_type, IoServiceProvider>& ps,
          const boost::asio::ip::basic_endpoint<InternetProtocol>& endpoint,
          bool reuse_addr = true)
      : boost::asio::basic_io_object<service_type>(ps.get_io_service())
    {
      this->service.set_protocol_service(this->implementation, ps);

      boost::system::error_code ec;
      open(endpoint.protocol(), ec);
      detail::throw_error(ec);
      if (reuse_addr)
      {
        set_option(boost::asio::socket_base::reuse_address(true), ec);
        detail::throw_error(ec);
      }
      bind(endpoint, ec);
      detail::throw_error(ec);
      listen(boost::asio::socket_base::max_connections, ec);
      detail::throw_error(ec);
    }
 nova_endpoint(boost::asio::ip::basic_endpoint<Protocol> const & other):
     type_(other.protocol().family(), other.protocol().type(), other.protocol().protocol())
 {
     assert(capacity() >= other.capacity());
     std::memcpy(&data_.base, other.data(), other.capacity());
 }