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


Groups > comp.lang.python > #18715

Re: socket.gethostbyaddr( os.environ['REMOTE_ADDR'] error

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!tudelft.nl!txtfeed1.tudelft.nl!multikabel.net!newsfeed10.multikabel.net!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed6.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.037
X-Spam-Evidence '*H*': 0.93; '*S*': 0.00; '[0]': 0.09; 'operation,': 0.09; 'subject:error': 0.09; 'am,': 0.12; 'received:209.85.214.174': 0.13; '+short': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'instance:': 0.16; 'inverse': 0.16; 'name)': 0.16; 'rotation': 0.16; 'wrote:': 0.18; 'jan': 0.19; 'header:In-Reply-To:1': 0.22; '(and': 0.28; 'message-id:@mail.gmail.com': 0.28; 'order.': 0.29; 'usually': 0.31; 'quite': 0.32; 'list': 0.32; 'received:209.85.214': 0.32; 'tue,': 0.32; 'to:addr:python-list': 0.34; 'normally': 0.34; 'dns': 0.34; 'uses': 0.36; 'but': 0.37; 'list,': 0.37; 'received:google.com': 0.37; "there's": 0.37; 'received:209.85': 0.38; 'getting': 0.38; 'being': 0.39; 'received:209': 0.40; 'to:addr:python.org': 0.40; 'address': 0.61; 'results': 0.63; '2012': 0.67; 'note:': 0.69; '(first)': 0.84; 'subject:( ': 0.84; 'canonical': 0.91; 'subject:skip:s 20': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=SW+nHTDOV49yOvvfDkhbYeTYALSr0vC7ItK1reeVHUI=; b=I49niywg6FImZ3LILsmM+Y3Nz0MBpdfkAIWLLq4O4XHW1aVPMQThjxOi3DPlZrdvEE 9L5n45MjE4FZnRM0VabGN2oxXr7a/tve0hMxbfTzT8CptbzrQJfY0OiEP7wko1jVTLdK KOyMab40D6B2SIEOB9B0+2lrfjTuBc1eqWo+Q=
MIME-Version 1.0
In-Reply-To <4F0B6BBE.5090501@codeaurora.org>
References <d3865134-491c-45ea-a033-a394e64701db@z19g2000vbe.googlegroups.com> <jdsjld$mau$1@r03.glglgl.gl> <bacea15d-fae0-4b1f-8a8e-a8b06b561fc0@t30g2000vbx.googlegroups.com> <roy-F4BA5C.13424802012012@news.panix.com> <24123dfe-b2fc-4f4c-8dfe-23bfef19b205@m10g2000vbc.googlegroups.com> <roy-4CE54B.15314102012012@news.panix.com> <f683b8f4-3a59-4c9f-94ef-82a9017dcd31@m20g2000vbf.googlegroups.com> <4F0B6BBE.5090501@codeaurora.org>
Date Tue, 10 Jan 2012 10:14:25 +1100
Subject Re: socket.gethostbyaddr( os.environ['REMOTE_ADDR'] error
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.12
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.4554.1326150869.27778.python-list@python.org> (permalink)
Lines 18
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1326150869 news.xs4all.nl 6916 [2001:888:2000:d::a6]:44055
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:18715

Show key headers only | View raw


On Tue, Jan 10, 2012 at 9:35 AM, Dominic Binks <dbinks@codeaurora.org> wrote:
> The address database can have multiple names for the same IP address so
> gethostbyaddr returns a list - [0] being the first item in the list (and
> usually considered the canonical name)

Point to note: The inverse operation, getting IP addresses from names,
quite frequently returns multiple results - and in that case, there's
no "canonical name". You'll still usually want to take the zeroth
(first) item in the list, but often the list will change in order.
Try, for instance:

$ dig +short www.google.com

which uses DNS rotation as a form of load-balancing.

In any case, you normally just take the first entry.

ChrisA

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


Thread

Re: socket.gethostbyaddr( os.environ['REMOTE_ADDR'] error Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2012-01-02 16:49 +0100
  Re: socket.gethostbyaddr( os.environ['REMOTE_ADDR'] error Νικόλαος Κούρας <nikos.kouras@gmail.com> - 2012-01-02 10:18 -0800
    Re: socket.gethostbyaddr( os.environ['REMOTE_ADDR'] error Roy Smith <roy@panix.com> - 2012-01-02 13:42 -0500
      Re: socket.gethostbyaddr( os.environ['REMOTE_ADDR'] error Νικόλαος Κούρας <nikos.kouras@gmail.com> - 2012-01-02 11:51 -0800
        Re: socket.gethostbyaddr( os.environ['REMOTE_ADDR'] error Roy Smith <roy@panix.com> - 2012-01-02 15:31 -0500
          Re: socket.gethostbyaddr( os.environ['REMOTE_ADDR'] error Νικόλαος Κούρας <nikos.kouras@gmail.com> - 2012-01-09 14:19 -0800
            Re: socket.gethostbyaddr( os.environ['REMOTE_ADDR'] error Dominic Binks <dbinks@codeaurora.org> - 2012-01-09 14:35 -0800
              Re: socket.gethostbyaddr( os.environ['REMOTE_ADDR'] error Νικόλαος Κούρας <nikos.kouras@gmail.com> - 2012-01-09 15:04 -0800
              Re: socket.gethostbyaddr( os.environ['REMOTE_ADDR'] error Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2012-01-10 07:42 +0100
                Re: socket.gethostbyaddr( os.environ['REMOTE_ADDR'] error Chris Angelico <rosuav@gmail.com> - 2012-01-10 18:29 +1100
            Re: socket.gethostbyaddr( os.environ['REMOTE_ADDR'] error Chris Angelico <rosuav@gmail.com> - 2012-01-10 10:14 +1100
            Re: socket.gethostbyaddr( os.environ['REMOTE_ADDR'] error Nick Dokos <nicholas.dokos@hp.com> - 2012-01-09 18:32 -0500
            Re: socket.gethostbyaddr( os.environ['REMOTE_ADDR'] error Chris Angelico <rosuav@gmail.com> - 2012-01-10 13:08 +1100
      Re: socket.gethostbyaddr( os.environ['REMOTE_ADDR'] error Νικόλαος Κούρας <nikos.kouras@gmail.com> - 2012-01-02 11:54 -0800

csiph-web