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


Groups > comp.lang.python > #12041

Re: Order of addresses returned by socket.gethostbyname_ex()

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'responding': 0.04; 'received:verizon.net': 0.07; 'terry': 0.07; '(possibly': 0.09; 'contract.': 0.09; 'hostname': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'subject:()': 0.09; 'subject:addresses': 0.09; 'am,': 0.12; 'interfaces': 0.12; 'things.': 0.13; 'posts.': 0.16; 'reedy': 0.16; 'roy': 0.16; 'wrote:': 0.16; '(i.e.': 0.17; '>>>': 0.18; 'that?': 0.18; 'jan': 0.19; '(most': 0.21; 'resolution': 0.21; 'maybe': 0.21; 'header :In-Reply-To:1': 0.22; 'interface': 0.23; '(on': 0.23; 'changed': 0.24; 'testing': 0.24; 'expect': 0.25; 'load': 0.26; 'host': 0.27; 'indicated': 0.29; 'order.': 0.29; 'asking': 0.29; 'specified': 0.31; 'list': 0.32; 'to:addr:python-list': 0.33; 'header:User- Agent:1': 0.34; 'doc': 0.34; 'see,': 0.34; 'header:X-Complaints- To:1': 0.35; 'primary': 0.36; 'question': 0.36; 'for?': 0.37; 'but': 0.37; 'could': 0.38; 'received:org': 0.38; 'cases,': 0.38; 'patch': 0.38; 'some': 0.38; 'addresses': 0.38; 'subject:: ': 0.39; 'returned': 0.39; 'header:Mime-Version:1': 0.39; 'why': 0.39; 'to:addr:python.org': 0.39; 'case': 0.39; 'where': 0.40; 'hope': 0.61; 'kind': 0.61; 'results': 0.61; 'order': 0.62; 'our': 0.63; 'alternative': 0.64; 'address,': 0.72; 'order,': 0.73; 'article': 0.76; 'subject:Order': 0.77; 'subject:skip:s 20': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Terry Reedy <tjreedy@udel.edu>
Subject Re: Order of addresses returned by socket.gethostbyname_ex()
Date Mon, 22 Aug 2011 13:34:57 -0400
References <356978ef-e9c1-48fd-bb87-849fe8e27a79@p5g2000vbl.googlegroups.com> <roy-44FF9C.07265622082011@news.panix.com> <034ff4bf-e3e4-47ff-9a6c-195412431e73@s20g2000yql.googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding quoted-printable
X-Gmane-NNTP-Posting-Host pool-74-109-121-73.phlapa.fios.verizon.net
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0) Gecko/20110812 Thunderbird/6.0
In-Reply-To <034ff4bf-e3e4-47ff-9a6c-195412431e73@s20g2000yql.googlegroups.com>
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.323.1314034539.27778.python-list@python.org> (permalink)
Lines 46
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1314034539 news.xs4all.nl 23852 [2001:888:2000:d::a6]:41929
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:12041

Show key headers only | View raw


On 8/22/2011 7:39 AM, Tomas Lidén wrote:
> On 22 Aug, 13:26, Roy Smith<r...@panix.com>  wrote:
>> In article
>> <356978ef-e9c1-48fd-bb87-849fe8e27...@p5g2000vbl.googlegroups.com>,
>>   Tomas Lidén<to...@liden-privat.net>  wrote:
>>
>>> In what order are the addresses returned by socket.gethostbyname_ex()?
>>
>>> We know that gethostbyname() is indeterministic but hope that
>>> gethostbyname_ex() has a specified order.
>>
>> Why would you hope that?  Or maybe a better question is, why would you
>> expect that?  In general, all name resolution calls return results in
>> arbitrary order.  In some cases, results are intentionally changed on
>> every call (i.e. round-robin) in an attempt at load sharing.
>>
>> What kind of ordering were you hoping for?
>
> See previous posts.
>
> Basically I was asking about the contract for this method..

The doc "Return a triple (hostname, aliaslist, ipaddrlist) where 
hostname is the primary host name responding to the given ip_address, 
aliaslist is a (possibly empty) list of alternative host names for the 
same address, and ipaddrlist is a list of IPv4/v6 addresses for the same 
interface on the same host (most likely containing only a single address)."

> hoping that it is deterministic.

As far as I can see, that is not in the contract.

> Our testing indicated that the interfaces are returned in a specific
> order, but we want to know if this is really the case (on all
> platforms).

Even if it were so now, a patch could change things.

-- 
Terry Jan Reedy

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


Thread

Order of addresses returned by socket.gethostbyname_ex() Tomas Lidén <tomas@liden-privat.net> - 2011-08-21 23:37 -0700
  Re: Order of addresses returned by socket.gethostbyname_ex() Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-08-22 18:15 +1000
    Re: Order of addresses returned by socket.gethostbyname_ex() Tomas Lidén <tomas.liden.privat@gmail.com> - 2011-08-22 02:06 -0700
      Re: Order of addresses returned by socket.gethostbyname_ex() Cameron Simpson <cs@zip.com.au> - 2011-08-22 20:06 +1000
        Re: Order of addresses returned by socket.gethostbyname_ex() Tomas Lidén <tomas.liden.privat@gmail.com> - 2011-08-22 04:29 -0700
          Re: Order of addresses returned by socket.gethostbyname_ex() Cameron Simpson <cs@zip.com.au> - 2011-08-23 08:46 +1000
      Re: Order of addresses returned by socket.gethostbyname_ex() Chris Angelico <rosuav@gmail.com> - 2011-08-22 11:36 +0100
        Re: Order of addresses returned by socket.gethostbyname_ex() Tomas Lidén <tomas.liden.privat@gmail.com> - 2011-08-22 04:32 -0700
      Re: Order of addresses returned by socket.gethostbyname_ex() Roy Smith <roy@panix.com> - 2011-08-22 07:37 -0400
        Re: Order of addresses returned by socket.gethostbyname_ex() Paul Kölle <paul@subsignal.org> - 2011-08-22 14:18 +0200
          Re: Order of addresses returned by socket.gethostbyname_ex() Tomas Lidén <tomas.liden.privat@gmail.com> - 2011-08-22 05:33 -0700
      Re: Order of addresses returned by socket.gethostbyname_ex() Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-08-23 02:09 +1000
  Re: Order of addresses returned by socket.gethostbyname_ex() Roy Smith <roy@panix.com> - 2011-08-22 07:26 -0400
    Re: Order of addresses returned by socket.gethostbyname_ex() Tomas Lidén <tomas.liden.privat@gmail.com> - 2011-08-22 04:39 -0700
      Re: Order of addresses returned by socket.gethostbyname_ex() Roy Smith <roy@panix.com> - 2011-08-22 08:14 -0400
      Re: Order of addresses returned by socket.gethostbyname_ex() Terry Reedy <tjreedy@udel.edu> - 2011-08-22 13:34 -0400
  Re: Order of addresses returned by socket.gethostbyname_ex() Nobody <nobody@nowhere.com> - 2011-08-22 20:12 +0100

csiph-web