cURL / Mailing Lists / curl-library / Single Mail


RE: error (6) : name lookup timed out

From: Phil Blundell <>
Date: Thu, 04 Dec 2008 20:44:41 +0000

On Thu, 2008-12-04 at 12:03 -0800, Gary Maxwell wrote:
> The problem is, how would the application handle this, and why should it
> have to handle it anyway? Polling for a change in self-IP is silly, and
> I haven't seen a standard way of alerting anything above the socket
> layer when this happens. Doesn't libcurl close down the connection when the
> next access to the cached connection fails, anyway?

Libcurl does indeed close down the cached connection when the socket
times out. But this takes some time to happen, and libcurl has no way
of knowing that this is a global problem so each cached connection will
have to wait individually for its own timeout.

You're right that there is, unfortunately, no standard way for
applications to be notified when the local network is reconfigured. You
can do it on Linux using AF_NETLINK sockets, and I think the same
applies to AF_ROUTE on BSD4.4 and its derivatives, but beyond that I
have no idea.

As to "why should the application have to handle it", I guess one answer
is that the application doesn't strictly need to handle it at all: as
you point out, the application can just do nothing and libcurl will
indeed eventually sort things out on its own. But, on the other hand,
for applications that can (or do already) figure out when the network
configuration has changed, it seems natural to provide a mechanism so
that libcurl can benefit from this knowledge as well in order to make
things work better.

Received on 2008-12-04