Boost logo

Boost Users :

Subject: Re: [Boost-users] [asio] negating address_configured
From: Juraj Ivanèiæ (juraj.ivancic_at_[hidden])
Date: 2011-03-04 08:30:36


On 4.3.2011 11:48, Alexander Lamaison wrote:
> What is the correct way to negate the (default) resolver flag,
> address_configured?
>
> On Windows, at least, specifying address_configured (which translates to
> AI_ADDRCONFIG) has a nasty side effect. If the 'external' network is down,
> the resolver can no longer resolve the "localhost" address. More here
> http://src.chromium.org/viewvc/chrome/trunk/src/net/base/host_resolver.cc?r1=16212&r2=16211
>
> address_configured is the default flag for ip::basic_resolver_query so I
> need to specify a flag that turns it off. In the underlying addrinfo
> struct this would just mean specifying 0 as the flag but that isn't an
> option with ASIO as far as I can tell. How would I do this?

I ran into this problem, and came up with the following workaround:

boost::asio::ip::tcp::resolver::query query(
     hostname,
     port,
     boost::asio::ip::tcp::resolver::query::all_matching
);

HTH


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net