Discussion:
[asio-users] udp::resolver::query, host not found
tim
2013-08-09 09:12:48 UTC
Permalink
hi all,

i'm having one problem, converting a program that uses gethostbyname to
boost.asio:

on a machine without network connection (only loopback), gethostbyname
behaves quite differently from udp::resolver::query: resolving strings
like "127.0.0.1" or "localhost", boost.asio gives me the error message
Host not found (authoritative), while gethostbyname performs the
resolution nicely:

old code:
struct hostent *he = gethostbyname(hostname);

boost.asio code:
udp::resolver resolver(ioService);
udp::resolver::query query(udp::v4(), hostname, "");
udp::resolver::iterator iterator = resolver.resolve(query, err_c);

any idea, how to work around this?

thanks, tim

Loading...