Opened 11 years ago
Closed 10 years ago
#5903 closed Bugs (invalid)
acceptor usage
Reported by: | Owned by: | chris_kohlhoff | |
---|---|---|---|
Milestone: | To Be Determined | Component: | asio |
Version: | Boost 1.47.0 | Severity: | Problem |
Keywords: | Cc: |
Description
Can't we listen on two different ports using same acceptor object?
For eg:
func() {
boost::asio::ip::tcp::acceptor acceptor_;
For port no 5555
boost::asio::ip::tcp::resolver resolver(io_service_); boost::asio::ip::tcp::resolver::query query(address, port1); boost::asio::ip::tcp::endpoint endpoint = *resolver.resolve(query); acceptor_.open(endpoint.protocol());
For port no 6666
boost::asio::ip::tcp::resolver::query query2(address, port2); boost::asio::ip::tcp::endpoint endpoint2 = *resolver.resolve(query2); acceptor_.open(endpoint2.protocol());
}
When i had tried to run the program i got the following exception:
First-chance exception at 0x75f0d36f in HttpServer3.exe: Microsoft C++ exception: boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::system::system_error> > at memory location 0x0012f554..
Or Do I have a misunderstanding on acceptor concepts...
Pl clarify me...
Change History (2)
comment:1 by , 11 years ago
comment:2 by , 10 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
One acceptor is required per listening endpoint, as noted by Olaf.
AFAIK you need one acceptor per endpoint. Would be nice to support something like acceptor groups.