Order of addresses returned by socket.gethostbyname_ex()

Tomas Lidén tomas.liden.privat at gmail.com
Mon Aug 22 07:39:39 EDT 2011

On 22 Aug, 13:26, Roy Smith <r... at panix.com> wrote:
> In article
> <356978ef-e9c1-48fd-bb87-849fe8e27... at p5g2000vbl.googlegroups.com>,
>  Tomas Lidén <to... at 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.. hoping
that it is deterministic.
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


More information about the Python-list mailing list