|
Boost : |
From: Christopher Kohlhoff (chris_at_[hidden])
Date: 2006-06-04 22:06:11
Hi Pedro,
Pedro Lamarão <pedro.lamarao_at_[hidden]> wrote:
> > I'm reformatting old example code, I'll try to populate
> > those pages with simpler, more to the point, example usage
> > today.
>
> Well, I did add _one_ new example usage to the docs, which I
> had to save from the old stuff by changing the implementation.
>
> The documentation is still here:
> http://mndfck.org/~pedro.lamarao/projects/network/
>
> More descriptive stuff here:
> http://mndfck.org/~pedro.lamarao/projects/network/pages.html
>
> What do the asio people think about this approach?
> I could work a patch out to put this stuff in and see
> what happens.
The post-review asio code has something quite similar which is
also called a 'resolver'. It was added to provide protocol
independence between IPv4 and IPv6, and is likewise based on
getaddrinfo() and getnameinfo(). For example:
tcp::resolver r(io_service);
tcp::resolver::query q("boost.org", "http");
tcp::resolver::iterator i = r.resolve(q);
tcp::resolver::iterator end;
while (i != end)
{
tcp::endpoint e = *i;
...
++i;
}
There's also a resolver::async_resolve() function.
Cheers,
Chris
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk