Boost logo

Boost :

From: Christopher Kohlhoff (chris_at_[hidden])
Date: 2006-03-13 07:24:17

Hi Jeff,

--- Jeff Flinn <TriumphSprint2000_at_[hidden]> 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

ip::tcp::resolver resolver(io_service);
ip::tcp::resolver::query query("", "daytime");
ip::tcp::resolver::iterator iter = resolver.resolve(query);
ip::tcp::resolver::iterator end;
while (iter != end)
  ip::tcp::endpoint endpoint = iter->endpoint();


Boost list run by bdawes at, gregod at, cpdaniel at, john at