[Interest] Qt not resolving URLs

Tom Isaacson Tom.Isaacson at navico.com
Tue Aug 6 06:51:41 CEST 2013


I've added a simple browser page to my application using the demo code in Qt 4.8 as a base:
[QTDIR]\demos\browser

This works fine in Windows, but when I rebuild the app and try it on my embedded Linux device it fails. While experimenting I found I could load www.google.com by resolving the IP address and using that instead. I added the following code to my app:
QHostInfo hostInfo = QHostInfo::fromName(m_url);
if (hostInfo.error() != QHostInfo::NoError)
{
    qDebug() << "Lookup failed:" << hostInfo.errorString();
}
foreach (QHostAddress hostAdd, hostInfo.addresses())
{
    qDebug() << "Found address:" << hostAdd.toString();
}
This outputs the error "Temporary failure in name resolution". So on the device I've tried:

1. Checked /etc/resolv.conf - looks good.
2. Checked my gateway shows up in "route -n" - looks good.
3. Tried "ping 8.8.8.8" - works fine.
4. Tried "nslookup www.google.com" - works fine.
5. Tried "wget http://www.google.com" - correctly loads index.html.

I can only imagine that Qt is using a different method to resolve DNS addresses but I have no idea what it could be. Does anyone have any suggestions?

Tom Isaacson





More information about the Interest mailing list