Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #33338

Re: Subprocess puzzle and two questions

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!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.006
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'socket': 0.05; 'subject:two': 0.07; 'oh,': 0.09; 'ping': 0.09; 'times,': 0.13; 'enough.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'processes.': 0.16; 'roy': 0.16; 'subject:questions': 0.16; 'tcp': 0.16; 'time.time()': 0.16; 'wrote:': 0.17; 'thu,': 0.17; 'import': 0.21; '(b)': 0.22; 'assumes': 0.22; '15,': 0.23; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'used,': 0.27; 'message-id:@mail.gmail.com': 0.27; 'actual': 0.28; '(since': 0.29; 'case,': 0.29; 'connection': 0.30; 'seconds': 0.30; 'print': 0.32; '(a)': 0.33; 'to:addr:python- list': 0.33; 'received:google.com': 0.34; 'server': 0.35; 'nov': 0.35; 'remote': 0.35; 'received:209.85': 0.35; 'really': 0.36; 'but': 0.36; 'supporting': 0.37; 'received:209': 0.37; 'far': 0.37; 'subject:: ': 0.38; 'supports': 0.38; 'some': 0.38; 'several': 0.39; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'your': 0.60; 'more': 0.63; 'smith': 0.71; 'comparable': 0.84; '"it': 0.91
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=BRwfDtOtpODUDzV3ASwWIA++1IO0oapUHmrkZg5Gt28=; b=NAXk2Uv0EbFTzyMGXQmiY6FEFlna9LL18nSzyqfefMDO5GNKTgDMnXTsrhzaU81x/T tREPX9U6cWXlL908mBw+6W+0zgmmPOODOvLlTxWEu9fGwtHYsD3GuwTliI/SKSneg1iu pJHsBYo8KfZYPyQ2n1nsjoOUbt9YEMfpMpcU3JG4nUuUAod/OAopBe2UxgOiZgucs+xO ncU1ooAgu1qdu7av1XBs8TBYHplZ4l0g9wc1ZLTdasWaQOPivMUeEzL4sQr8+fZDBlga TIiVe8q8XMRISRmBrb+LoTF/wJh0dt6yk0VvS4xCXA8dM+6axAzSxA149PUY1kWACUp5 KhgQ==
MIME-Version 1.0
In-Reply-To <roy-F5C640.09225714112012@news.panix.com>
References <mailman.3664.1352867713.27098.python-list@python.org> <roy-9D599D.23412413112012@news.panix.com> <mailman.3666.1352873042.27098.python-list@python.org> <roy-F5C640.09225714112012@news.panix.com>
Date Thu, 15 Nov 2012 01:40:05 +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.3684.1352904008.27098.python-list@python.org> (permalink)
Lines 21
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1352904008 news.xs4all.nl 6892 [2001:888:2000:d::a6]:60310
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:33338

Show key headers only | View raw


On Thu, Nov 15, 2012 at 1:22 AM, Roy Smith <roy@panix.com> 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...
>
> import socket
> import time
> s = socket.socket()
> t0 = time.time()
> s.connect(('8.8.8.8', 53))
> t1 = time.time()
> print "it took %f seconds to connect" % (t1 - t0)

That assumes that (a) the remote server supports TCP for DNS (since
UDP is by far the more often used, some name servers don't bother
supporting TCP), and (b) that connection time for TCP is comparable to
ping or an actual DNS lookup. But in terms of approximating your
connection times, that's gotta be way better than shelling out to
several other processes.

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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