Sockets, DNS and timeouts

Grant Beasley gbeasley at
Mon Nov 26 08:23:52 CET 2001


I'm using the DNS module from Anthony Baxter in an attempt to validate email
hosts (By an MX/A lookup). It's working very well, except that with certain
addresses everything hangs. I think it's an issue with the addresses I'm
checking because if I do an nslookup on the same address it eventually times

The problem appears to be that there isn't a timeout in the DNS module (and
sockets in general??). I've read a few older archived messages about
implementing timeouts via threads, etc. Generally speaking, they were a bit
over my head, so I was hoping there's a simpler solution (maybe with a later
version of Python).

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?

Any help appreciated.


More information about the Python-list mailing list