
Hi Peter, Peter Petrov <ppetrov@ppetrov.com> wrote:
There is one thing that caught my eye. In the changelog you have the following comment:
* Resolver replaces ipv4::host_resolver.
...
ip::tcp::resolver resolver(io_service);
Why is "resolver" in the "ip::tcp" namespace? A DNS resolver certainly has nothing to do with the TCP protocol. It should be in the "ip" namespace instead.
Unlike the old host_resolver class, which would resolve a host name into an address, the new resolvers turn host name and service name into a list of endpoints. This interface is based on getaddrinfo() function. We now have: - ip::tcp::resolver, which returns a list of ip::tcp::endpoint objects - ip::udp::resolver, which returns a list of ip::udp::endpoint objects Resolvers for other protocols, can (if supported by getaddrinfo on the target platform) be created by instantiating the asio::basic_resolver<> template on an appropriately defined protocol class. So, ip::tcp::resolver is very much specific to TCP, but basic_resolver<> isn't - it's not even specific to IP (in theory, anyway). Cheers, Chris