Subprocess puzzle and two questions
roy at panix.com
Wed Nov 14 17:20:54 CET 2012
>> Oh, my. You're using DNS as a replacement for ping? Fair enough. In
>> that case, all you really care about is that you can connect to port 53
>> on the server...
>> s = socket.socket()
>> s.connect(('188.8.131.52', 53))
In article <mailman.3684.1352904008.27098.python-list at python.org>,
Chris Angelico <rosuav at gmail.com> wrote:
>That assumes that (a) the remote server supports TCP for DNS
This is true. I honestly don't know what percentage of DNS servers
out there only support UDP. The two I tried (Google's 184.108.40.206, and my
Apple TimeCapsule) both supported TCP, but that's hardly a
> and (b) that connection time for TCP is comparable to
> ping or an actual DNS lookup.
My first thought to solve both of these is that it shouldn't be too
hard to hand-craft a minimal DNS query and send it over UDP. Then, I
hunted around a bit and found that somebody had already done that, in
spades. Take a look at http://www.dnspython.org; it might be exactly
what's needed here.
More information about the Python-list