socket.gethostbyaddr problem

Irmen de Jong irmen.NOSPAM at xs4all.nl
Sat Sep 17 22:52:37 EDT 2005


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



More information about the Python-list mailing list