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
Perhaps you mean to use the function socket.gethostbyname instead.
>>> import socket
>>> socket.gethostbyaddr("www.google.ca")
Traceback (most recent call last):
File "", line 1, in ?
socket.herror: (1, 'Unknown host')
>>> socket.gethostbyname("www.google.ca")
'64.233.167.147'
Jeff
pgpsZ1m3Oc