Sockets, DNS and timeouts

Martin von Loewis loewis at
Mon Nov 26 11:09:20 CET 2001

"Grant Beasley" <gbeasley at> writes:

> The problem appears to be that there isn't a timeout in the DNS
> module (and sockets in general??).

If it uses TCP, there will be a timeout on the TCP connection. If it
uses UDP, it apparently doesn't timeout, although it would possible to
rewrite it to use a timeout.

> Is there an easy way to wrap something in a timeout that'll exit
> gracefully without actually having to change the code in the DNS
> module?

I don't think there is. It may be possible, but it is not easy.

Instead, I recommend you try to use the DnsAsyncRequest, passing a
"done" handler. It looks like the code hasn't been tested that much,
so you may need to dive into the details even if you take this route.


More information about the Python-list mailing list