problem with gethostbyaddr with intranet addresses on MAC

Vladimir Rusinov vladimir at greenmice.info
Fri Jan 25 06:30:43 EST 2008


On 1/25/08, shailesh <shaileshk at gmail.com> wrote:
>
> apples-computer:~ apple$ ping 192.168.4.123
> PING 192.168.4.123 (192.168.4.123): 56 data bytes
> 64 bytes from 192.168.4.123: icmp_seq=0 ttl=64 time=0.328 ms
> 64 bytes from 192.168.4.123: icmp_seq=1 ttl=64 time=0.236 ms
> 64 bytes from 192.168.4.123: icmp_seq=2 ttl=64 time= 0.255 ms
> ^C
> --- 192.168.4.123 ping statistics ---
> 3 packets transmitted, 3 packets received, 0% packet loss
> round-trip min/avg/max/stddev = 0.236/0.273/0.328/0.040 ms
> apples-computer:~ apple$ python2.4
> Python 2.4.4 (#1, Oct 18 2006, 10:34:39)
> [GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> from socket import *
> >>> x = gethostbyname('google.com')
> >>> x
> '64.233.167.99'
> >>> gethostbyaddr(x)
> ('py-in-f99.google.com', [], ['64.233.167.99'])
> >>> e = '192.168.4.123'
> >>> gethostbyaddr(e)
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> socket.herror: (1, 'Unknown host')
> >>>
>

I'm sure your dns server have no reverse records for ' 192.168.4.123'.
So, it can't resolve it (123.4.168.192.in-addr.arpa).

-- 
Vladimir Rusinov
GreenMice Solutions: IT-решения на базе Linux
http://greenmice.info/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080125/789f3c76/attachment-0001.html>


More information about the Python-list mailing list