示例#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);
   this->implementation.endpoint_ = endpoint;
 }
示例#2
0
 explicit basic_request_acceptor(
       common::basic_protocol_service<protocol_type, IoServiceProvider>& ps,
       const InternetProtocol& ip,
       const native_type& native_acceptor)
   : boost::asio::basic_io_object<service_type>(ps.get_io_service())
 {
   this->service.set_protocol_service(this->implementation, ps);
   boost::system::error_code ec;
   this->service.assign(this->implementation, ip, native_acceptor, ec);
   detail::throw_error(ec);
 }
示例#3
0
    explicit basic_request_acceptor(
          common::basic_protocol_service<protocol_type, IoServiceProvider>& ps)
      : boost::asio::basic_io_object<service_type>(ps.get_io_service())
    {
      this->service.set_protocol_service(this->implementation, ps);

      boost::system::error_code ec;
      if (this->service.default_init(this->implementation, ec)) {
        detail::throw_error(ec);
      }
    }
示例#4
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);
    }