473,394 Members | 1,739 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

problem with gethostbyaddr with intranet addresses on MAC

Hi,

I am facing a peculiar problem. socket.gethostbyaddr is not working
fine on my MAC for ip addresses on the LAN. The LAN happens to consist
of linux and windows machines and this is the only one MAC on the
LAN.

Please see the example below. I am getting error: socket.herror: (1,
'Unknown host')

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')
>>>

With regards,
- Shailesh

Jan 25 '08 #1
1 3625
shailesh <sh*******@gmail.comwrote:
>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')
>>>>
So what are you expecting it to return? Or, to put it another way,
what would you feed to gethostbyname() to get 192.168.4.123 back?
Can you get the "right" answer from host or some other command-
line tool? Can you get an answer from gethostbyaddr() on one of
the other machines on the network? How do they do their name
resolution?

--
\S -- si***@chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
"Frankly I have no feelings towards penguins one way or the other"
-- Arthur C. Clarke
her nu becomež se bera eadward ofdun hlęddre heafdes bęce bump bump bump
Jan 28 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: CPD | last post by:
I can't parse $_SERVER when using the alphabetic key instead of the numeric index of the array. Below is some of the line-numbered code, followed by the corresponding output. For this posting, IP...
0
by: Sibylle Koczian | last post by:
Hello all, the documentation for the socket module says that gethostbyaddr should return the primary host name and alternative host names if there are any. But the alias list is empty even in...
2
by: Prashanth | last post by:
Hi, I am sending mails using CDO.Message . It is sending mails successfully only if the destination addresses are within the intranet. If you try to send a mail outside the intranet say...
2
by: Harlin Seritt | last post by:
I have a list of IP addresses I am testing with socket.gethostbyaddr(). For the most part, I am able to get a hostname returned to me when I run gethostbyaddr(). I am also hoping this will allow me...
2
by: christian9997 | last post by:
Hi Since yesterday about 11.00 CET the gethostbyaddr function doesn't seem to be working. All I get is the IP address back. Is this something general to all PHP users or is this specific to my...
2
by: rn5a | last post by:
I am working on WinXP Pro (SP2) & use IIS5.1 as the intranet server to run ASP applications. I connect to the Internet using a LAN connection. My PC is a standalone machine. Of late, what I find...
1
by: lakshmiraja | last post by:
hi, I came to know that gethostbyaddr is deprecated in Visual Studio 2005 by the introduction of getnameinfo function. Can i know the reason for the deprecation of gethostbyaddr function. Is...
4
by: Barbiturico76 | last post by:
Hi guys, anybody knows if it is possible to generate a <div id="myMap" style="width: 400; height:300; left: 0px; top: 0px;" /> inside your intranet site, to represent a programmatically...
24
by: RJ_32 | last post by:
When there is no rDNS record on an IP address, then it might take a while for the reverse lookup to timeout. I'm thinking of how on a tracert you can observe the delay. If so, then calling...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.