473,779 Members | 2,001 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem with gethostbyaddr with intranet addresses on MAC

Hi,

I am facing a peculiar problem. socket.gethostb yaddr 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 3642
shailesh <sh*******@gmai l.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 '
>>>gethostbyadd r(x)
('py-in-f99.google.com' , [], ['64.233.167.99'])
>>>e = '192.168.4.123'
gethostbyadd r(e)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
socket.herro r: (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.gr eenend.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
2502
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 address and domains shown are fictitious. Note how the REMOTE_HOST is resolved by gethostbyaddr() using a hard-coded IP address or the array index "10", but it fails completely when the literal key REMOTE_ADDR is used. Any help with this will...
0
1643
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 cases where I know aliases exist. I can get them using gethostbyname_ex, but that only works with names, not with IP addresses, and I want to resolve both sorts. I'm using Python 2.3.2 on Windows NT4, SP6.
2
15956
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 someone@yahoo.com it gives an error. Error No : -2147220977 Error Desc : The server rejected one or more recipient addresses. The server response was: 550 5.7.1 Unable to relay for someone@yahoo.com
2
3203
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 to tell if a computer is up or down. However, in my environment, I am finding that I am able to get a hostname even though I am unable to actually ping that server (when I ping a server i like this, I get 'request timed out' messages telling me...
2
3102
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 server? Thanks BTW what's the difference between comp.lang.php, alt.php and alt.comp.lang.php, shouldn't these groups be merged?
2
1288
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 is if I am not connected to the Internet, it takes quite some time for local intranet ASP pages (that physically reside in my PC) to get downloaded completely but if I am connected to the Internet, then the same ASP pages get downloaded in a...
1
3138
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 there any security issues related with this function? Also came to know that calling this function is not thread safe. I am not able to get the exact reason for not using gethostbyaddr function.
4
1988
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 generated map with the "http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.1" script reference?
24
2502
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 gethostbyaddr() can delay the serving of the web page, right? Because gethostbyaddr() is not forked into a separate process. So I suppose I'd need to call gethostbyaddr() as the very last task for a script. Does that sound right? Or is there another...
0
9632
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10302
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10136
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10071
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9925
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6723
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5501
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4036
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2867
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.