socket.gethostbyaddr problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mohammed Smadi

    #1

    socket.gethostbyaddr problem

    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.gethostb yaddr("www.goog le.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

  • Irmen de Jong

    #2
    Re: socket.gethostb yaddr problem

    Mohammed Smadi wrote:[color=blue]
    > 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.gethostb yaddr("www.goog le.ca")
    >
    > return an error: socket.herror: (1, 'Unknown host')[/color]

    You're using the wrong method.
    [color=blue][color=green][color=darkred]
    >>> socket.gethostb yname("www.goog le.ca")[/color][/color][/color]
    '66.102.9.147'


    --Irmen

    Comment

    Working...