From: christopher baus (christopher_at_[hidden])
Date: 2006-08-17 02:27:13
I'm converting some code from the previous asio release to the latest 0.37
and I am confused by the new resolver interface.
ip::tcp::resolver::query query("foobar.com", "http");
ip::tcp::resolver::iterator iter = resolver.resolve(query);
while (iter != end)
ip::tcp::endpoint ep = *iter;
std::cout << iter->endpoint() << std::endl;
std::cout << iter->host_name() << std::endl;
std::cout << iter->service_name() << std::endl;
The resolver::query requires a service name string. I want to specify a
port number so that the endpoints returned by the resolver::iterator are
configured with that specified port rather than those returned by the
It isn't clear to me, but it looks like it should be possible by passing
numeric_service in the query flags, but on Windows AI_NUMERICSERV isn't
defined and numeric_service == 0. Plus that leaks the rather ugly
getaddrinfo() interface of using numeric strings.
It would be nice if the interface allowed:
ip::tcp::resolver::query query("foobar.com", 80);
I feel like I might be missing something here.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk