LookupHost Class Reference

#include <lookuphost.h>

+ Inheritance diagram for LookupHost:

Static Public Member Functions

static void finalizeAndJoin ()
 
static void lookupHost (const QString &name, QObject *receiver, const char *receiverSlot)
 

Friends

class LookupHostAborter
 
class LookupHostWorker
 

Detailed Description

QHostInfo (Qt 4.8.6) has a bug on Windows that prevents the program from exitting properly. If you return from main() while a lookupHost() is in progress, the program will hang in limbo forever. Its process will be visible in the task manager. Its executable will remain locked for writing.

Aborting the lookup before returning from main() doesn't solve the problem.

Long lookupHost() can be easily caused by looking up a LAN address such as 10.0.0.2 or 192.168.0.20, both if that address exists in your network or doesn't even make any sense (ie. your network is class C and you try to get address from class A). Another case is where you try to resolve an actual domain, such as www.example.org, and your Internet connection is down.

This problem can be worked around by looking up hosts in a separate thread and keeping count on how many lookups are running at the moment. The main thread can synchronize with lookup thread and wait for all lookups to finish before returning from main().

Naturally, on non-Windows OSes all works fine...

What's even more interesting, is that QNetworkAccessManager doesn't seem to be causing any trouble when you try to resolve a domain name while your Internet connection is down.

Definition at line 61 of file lookuphost.h.


The documentation for this class was generated from the following files: