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:
I can only imagine that Qt is using a different method to resolve DNS addresses but I have no idea what it could be.
It turns out that "Temporary failure in name resolution" is the error EAI_AGAIN, which getaddrinfo() returns when it doesn't really know what the problem is. It was failing because I was running nslookup as root but the application was running under a user account, and by mistake only root had read permission for /etc/resolv.conf. Once I did a chmod everything worked.
To fix this permanently we added a chmod to /usr/libexec/udhcpc.sh so the permission on /etc/resolve.conf is set correctly when it's created.