gethostbyname_ex(hostname) extremely slow (crossposted from stackoverflow)

Michael Torrie torriem at gmail.com
Sun Sep 1 01:06:43 EDT 2013


On 08/31/2013 10:51 PM, anntzer.lee at gmail.com wrote:
> It is the call to gethostbyname_ex that is very slow.  The call to
> gethostname is quick (and returns the same string as
> /usr/bin/hostname).

What gethostbyname_ex and /usr/bin/hostname do are very different
things.  gethostbyname_ex does a DNS lookup against a server.
/usr/bin/hostname just checks a local computer setting.  I don't see why
you are comparing the two.  /usr/bin/hostname is not going to help you
find a list of IP addresses that point to a machine.



More information about the Python-list mailing list