Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #33356
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'subject:two': 0.07; 'python': 0.09; 'check.': 0.09; 'dns,': 0.09; 'oh,': 0.09; 'percentage': 0.09; 'ping': 0.09; 'recommends': 0.09; 'wraps': 0.09; 'yeah,': 0.09; 'server,': 0.15; 'slightly': 0.15; 'enough.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'literal,': 0.16; 'roy': 0.16; 'subject:questions': 0.16; 'tcp': 0.16; 'tcp,': 0.16; 'time.time()': 0.16; 'string': 0.17; 'wrote:': 0.17; "shouldn't": 0.17; 'thu,': 0.17; 'solution.': 0.18; '>>>': 0.18; 'bit': 0.21; 'received:209.85.214.174': 0.21; '(b)': 0.22; 'assumes': 0.22; 'option.': 0.22; 'simpler': 0.22; '15,': 0.23; 'somebody': 0.23; 'tried': 0.25; 'header:In-Reply-To:1': 0.25; 'looks': 0.26; 'supported': 0.26; 'am,': 0.27; 'message- id:@mail.gmail.com': 0.27; 'actual': 0.28; 'chris': 0.28; 'once,': 0.29; 'surprised': 0.29; 'case,': 0.29; "i'm": 0.29; 'connection': 0.30; 'minimal': 0.30; 'query': 0.30; 'function': 0.30; 'point': 0.31; '(a)': 0.33; 'docs': 0.33; 'true.': 0.33; 'to:addr:python- list': 0.33; 'that,': 0.34; 'received:google.com': 0.34; 'done': 0.34; 'server': 0.35; 'needed': 0.35; 'fail': 0.35; 'nov': 0.35; 'remote': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'really': 0.36; 'but': 0.36; 'url:org': 0.36; 'apple': 0.36; 'too': 0.36; 'supporting': 0.37; 'two': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'supports': 0.38; 'to:addr:python.org': 0.39; 'received:209.85.214': 0.39; 'header:Received:5': 0.40; 'save': 0.61; 'first': 0.61; 'solve': 0.62; 'ever': 0.63; 'times': 0.63; 'response.': 0.67; 'smith': 0.71; 'sounds': 0.71; 'article': 0.78; 'comparable': 0.84; 'flip': 0.84; 'hardly': 0.84; 'outgoing': 0.91; 'eliminates': 0.93 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=gxfPhQCY7PzjN2M3hbWWCoYmdH0Gp1q5jXwwuYPldJg=; b=UoUudO7KmPlipMcJR5YkLx2rwacV+Q5YZdj6UpCZyNIpqR7SPqORC50hwxqaTwmV/w NuJ5uhHziE2LsZEFKHdOfpXpMQVT98ega+eU3Gkns+IV/pO/BdEq79W9Lx+Vck6fXz2C 61+duODC9vnrZ/DPVc+sRXhGCWg+gkjoxY5E/5+SQnTWmKk3DMHhfczjFAUGDZ+DA64P yBXn1LgTATArT9b9gEtfKG2nSKHiE3LRCBoyMThzeYircOejITIXx9JcSGo2CGjFqRs0 h1q7otp+3F3tMDnjsMoCK2G4wxxtQMtUkU8iD93QLE8aK57aEdIyTEvyREMeHIoQ2q6W qOQA== |
| MIME-Version | 1.0 |
| In-Reply-To | <k80gd6$t0q$1@panix2.panix.com> |
| References | <mailman.3664.1352867713.27098.python-list@python.org> <mailman.3666.1352873042.27098.python-list@python.org> <roy-F5C640.09225714112012@news.panix.com> <mailman.3684.1352904008.27098.python-list@python.org> <k80gd6$t0q$1@panix2.panix.com> |
| Date | Thu, 15 Nov 2012 08:54:29 +1100 |
| Subject | Re: Subprocess puzzle and two questions |
| From | Chris Angelico <rosuav@gmail.com> |
| To | python-list@python.org |
| Content-Type | text/plain; charset=ISO-8859-1 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3700.1352930072.27098.python-list@python.org> (permalink) |
| Lines | 42 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1352930072 news.xs4all.nl 6846 [2001:888:2000:d::a6]:47669 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:33356 |
Show key headers only | View raw
On Thu, Nov 15, 2012 at 3:20 AM, Roy Smith <roy@panix.com> wrote:
> I wrote:
>>> 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(('8.8.8.8', 53))
>
> In article <mailman.3684.1352904008.27098.python-list@python.org>,
> Chris Angelico <rosuav@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 8.8.8.8, and my
> Apple TimeCapsule) both supported TCP, but that's hardly a
> representitive sample.
I don't know either, all I know is that DNSReport recommends
supporting TCP, and none of my DNS servers ever fail that check.
>> 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.
Yeah, that sounds like a good option. I'm slightly surprised that
there's no way with the Python stdlib to point a DNS query at a
specific server, but dnspython might be the solution. On the flip
side, dnspython is dauntingly large; it looks like a full
implementation of DNS, but I don't see a simple entrypoint that wraps
it all up into a simple function that can be bracketed with
time.time() calls (granted, I only skimmed the docs VERY quickly). So
it may be simpler to hand-craft an outgoing UDP packet once, save it
as a string literal, send that, and just wait for any response. That
eliminates all DNS protocolling and just times the round trip.
ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Subprocess puzzle and two questions wrw@mac.com - 2012-11-13 22:34 -0500
Re: Subprocess puzzle and two questions Roy Smith <roy@panix.com> - 2012-11-13 23:41 -0500
Re: Subprocess puzzle and two questions William Ray Wing <wrw@mac.com> - 2012-11-14 00:03 -0500
Re: Subprocess puzzle and two questions Roy Smith <roy@panix.com> - 2012-11-14 09:22 -0500
Re: Subprocess puzzle and two questions Chris Angelico <rosuav@gmail.com> - 2012-11-15 01:40 +1100
Re: Subprocess puzzle and two questions roy@panix.com (Roy Smith) - 2012-11-14 11:20 -0500
Re: Subprocess puzzle and two questions Chris Angelico <rosuav@gmail.com> - 2012-11-15 08:54 +1100
Re: Subprocess puzzle and two questions Roy Smith <roy@panix.com> - 2012-11-14 20:49 -0500
Re: Subprocess puzzle and two questions Chris Angelico <rosuav@gmail.com> - 2012-11-15 13:04 +1100
Re: Subprocess puzzle and two questions Roy Smith <roy@panix.com> - 2012-11-14 21:10 -0500
Re: Subprocess puzzle and two questions Chris Angelico <rosuav@gmail.com> - 2012-11-15 13:21 +1100
Re: Subprocess puzzle and two questions Dave Angel <d@davea.name> - 2012-11-14 21:55 -0500
Re: Subprocess puzzle and two questions Kushal Kumaran <kushal.kumaran+python@gmail.com> - 2012-11-15 10:23 +0530
Re: Subprocess puzzle and two questions Nobody <nobody@nowhere.com> - 2012-11-15 22:54 +0000
Re: Subprocess puzzle and two questions Roy Smith <roy@panix.com> - 2012-11-15 20:07 -0500
Re: Subprocess puzzle and two questions Nobody <nobody@nowhere.com> - 2012-11-17 00:17 +0000
DNS from Python (was Re: Subprocess puzzle and two questions) aahz@pythoncraft.com (Aahz) - 2012-11-14 21:42 -0800
Re: Subprocess puzzle and two questions wrw@mac.com - 2012-11-14 09:37 -0500
Re: Subprocess puzzle and two questions Tim Roberts <timr@probo.com> - 2012-11-13 23:17 -0800
csiph-web