
Hi Jeff, --- Jeff Flinn <TriumphSprint2000@hotmail.com> wrote:
This brings up one of the bothersome aspects of asio interface, IMHO.
Functions like:
template<typename Endpoint> void get_local_endpoint (Endpoint &endpoint)
make it difficult to use in the context of an initializer list.
As Arvid mentioned, this has already changed in asio's cvs repository. It's part of a change suggested during the review to add stronger typing for the socket classes. For example, you can now write: ip::tcp::socket socket(io_service); ... ip::tcp::endpoint ep = socket.local_endpoint();
Any reason this was not considered? The same goes for host and host resolver's get_host_by_name.
I intend to replace the host_resolver class with a new interface based on getaddrinfo/getnameinfo that can support both IPv4 and IPv6. This will probably return an iterator that can be used to enumerate all endpoints that match some criteria. E.g. something like: ip::tcp::resolver resolver(io_service); ip::tcp::resolver::query query("some.host", "daytime"); ip::tcp::resolver::iterator iter = resolver.resolve(query); ip::tcp::resolver::iterator end; while (iter != end) { ip::tcp::endpoint endpoint = iter->endpoint(); ... ++iter; } Cheers, Chris