By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,403 Members | 1,089 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,403 IT Pros & Developers. It's quick & easy.

socket.gethostbyaddr problem

P: n/a
hi;
I am trying to do some very basic socket programming and i get the
following error. Any help will be appreciated:

Code:
import socket
x = socket.gethostbyaddr("www.google.ca")

return an error: socket.herror: (1, 'Unknown host')

I tried replacing the web URL with an IP address on the net, on my LAN and
it does not work. It only works with "localhost" which is not very
useful. Am using Python 2.3.4 if that matters.

any direction will be great

moe smadi

Sep 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Mohammed Smadi wrote:
hi;
I am trying to do some very basic socket programming and i get the
following error. Any help will be appreciated:

Code:
import socket
x = socket.gethostbyaddr("www.google.ca")

return an error: socket.herror: (1, 'Unknown host')


You're using the wrong method.
socket.gethostbyname("www.google.ca")

'66.102.9.147'
--Irmen
Sep 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.