socket.gethostbyaddr() is slower than Christmas
Jason R. Mastaler
jason at mastaler.com
Wed Jul 17 18:27:24 EDT 2002
On a certain Redhat-7.3 system, socket.gethostbyaddr() calls to the
localhost are taking upwards of 30 seconds to return. What would
account for such behavior? Is this a bug?
For example,
$ python2
Python 2.2 (#1, Apr 12 2002, 15:29:57)
[GCC 2.96 20000731 (Red Hat Linux 7.2 2.96-109)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from socket import *
>>> name = gethostname()
>>> name
'datavortex.net'
>>> gethostbyaddr(name)
('datavortex.net', ['localhost.localdomain', 'localhost', 'im.corp.earthlink.net'], ['127.0.0.1'])
>>>
The gethostname() call is instantaneous, while the gethostbyaddr()
takes an unnaturally long time to finish.
--
(http://tmda.net/)
More information about the Python-list
mailing list