socket.gethostbyaddr problem

M

Mohammed Smadi

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
 
I

Irmen de Jong

Mohammed said:
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.
'66.102.9.147'


--Irmen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top