W3C home > Mailing lists > Public > www-lib@w3.org > October to December 2000

Re: GetHostByName & TimeOut

From: Steinar Bang <sb@metis.no>
Date: 11 Dec 2000 13:48:30 +0100
To: www-lib@w3.org
Message-ID: <wh4s0bxgwx.fsf@viffer.computas.no>
>>>>> "Franck DEGRYSE" <fdegryse@norsys.fr>:

> I perform an application under Windows NT & 2000 and I use Winsock.
> Could I specify a TimeOut to the function GetHostByName ?

The name of the function is gethostbyname() (all lowercase), and as
far as I can tell, it has the same behaviour on Win32 as on
unixen/linuxen: 
 It blocks for 2 to 5 minutes if it can't get a response from a DNS
 server.

For me, this is a problem, because it completely freezes up the GUI of 
my application for 2 to 5 minutes (it's a single threaded application, 
where the Qt event loop "drives" the libwww network handling).

I had some thoughts about this, back in March/April:
  <http://lists.w3.org/Archives/Public/www-lib/2000JanMar/thread.html#151>

The only way I figured out to do things at that time, would be to run
name lookups in a separate thread, before ever leaving the requests
over to libwww (a very limited use of multithreading).

I didn't wish to mess with multithreading just for this, so the
problem persists.

Since I'm using Qt, I guess I could use the same strategy, and use the 
non-blocking QDns class
	<http://doc.trolltech.com/qdns.html>
to do name lookups instead of using gethostbyname() inside of libwww. 

> There is a registry key ?

Not that I found.  If you find something, please tell me.
Received on Monday, 11 December 2000 07:52:20 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 23 April 2007 18:18:38 GMT