Order of addresses returned by socket.gethostbyname_ex()

Nobody nobody at nowhere.com
Mon Aug 22 21:12:16 CEST 2011

On Sun, 21 Aug 2011 23:37:42 -0700, Tomas Lidén 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.

It doesn't. In fact, the order of the IP addresses may have been
deliberately randomised (by the resolver and/or DNS server) in order to
provide a simple form of load balancing.

More information about the Python-list mailing list