W3C home > Mailing lists > Public > www-lib@w3.org > January to March 2000

gethostbyname() timeout

From: Steinar Bang <sb@metis.no>
Date: 14 Mar 2000 13:14:36 +0100
To: www-lib@w3.org
Message-ID: <whln3l21g3.fsf@viffer.metis.no>
This problem is observed both on linux (SuSE 6.2 w./kernel 2.2.10) and 
Win NT4.

We have a graphical editor program that uses libwww for HTTP support.
Every time we try to load a file, we first look in a local cache (the
application's own cache.  Not the one supplied by libwww), and if the
file isn't there we try doing an HTTP get to its actual whereabouts.

So far, so good.

However, if the machine running the graphical editor is offline, and a 
file cannot be found in the local cache, the editor freezes up for
long periods of time.

The reason is that it is stuck in gethostbyname(), inside
HTGetHostByName() in HTDNS.c.

I have cached missing host names outside of libwww, but the GUI freeze 
caused by that first call to gethostbyname() is big enough that the
BUG will probably still be counted as unfixed.

Maybe the timeout period of gethostbyname() can be reduced?  However
searches on the net has shown me no such options, neither for winsock
nor linux.

Maybe one approach to detecting the precense of a connected network
would be to ping a fixed IP number?  However we may still be connected 
to a network and reach some machines, with ping to a particular IP
being blocked by routers or jammed by traffic.

Any and all ideas are apprciated!


- Steinar
Received on Tuesday, 14 March 2000 07:14:41 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:33:52 UTC