r0g wrote: > r0g wrote: >> Gabriel Genellina wrote: >>> En Fri, 27 Nov 2009 22:35:36 -0300, r0g <aioe....@technicalbloke.com> >>> escribió: >>> >>>> gethostbyname ignores setdefaulttimeout. >>>> >>>> How big a job is it to use non-blocking sockets to write a DNS lookup >>>> function with a customisable timeout? A few lines? A few hundred? I'd > <snip> > > As usual, everything is working beautifully until I try to make it work > with windows! > > Turns out signals.SIGALRM is Unix only and I want to run on both > platforms so I have done as the docs suggested and tried to convert the > code to use threading.Timer to trigger an exception if the DNS lookup is > taking too long.
Actually none of that was necessary in the end. Digging into the pydns source to debug the 30 second pause I happened across the timeout parameter! >>> result = ping.do_one( "google.com", 5 ) "" Phew, that simplifies thing a lot! :) Roger. -- http://mail.python.org/mailman/listinfo/python-list