Order of addresses returned by socket.gethostbyname_ex()
roy at panix.com
Mon Aug 22 13:26:56 CEST 2011
<356978ef-e9c1-48fd-bb87-849fe8e27a79 at p5g2000vbl.googlegroups.com>,
Tomas Lidén <tomas 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?
More information about the Python-list