0

I am currently developing a simple server application which should be also IPv6 capable. IPv6 works fine on Windows (using MSVC2010), but it does not on Linux.

Imagine following code:

boost::system::error_code ec;
std::string address="::1", service="http";
tcp::resolver resolver(io_service);
tcp::resolver::query query(address, service);
tcp::resolver::iterator resiter = resolver.resolve(query, ec);

if (ec)
    std::cout << "Cannot resolve address: " << address << "(" << ec.message() << ")" << std::endl;

The error message printed on Linux is "Host not found (authoritative)", while it works on Windows.

Any hints are welcome.

asiouser
  • 11
  • 2

1 Answers1

0

Linux and Windows have different behavior with respect to the search order of address returned by the name services. Try using different flags to gain more fine-grained control over the type of address you are querying for. For example, for this query you could use the numeric_host flag.

karunski
  • 3,980
  • 2
  • 17
  • 10