Pingecho, causing SocketError.

Discussion in 'Ruby' started by Walle Wallen, Aug 2, 2010.

  1. Walle Wallen

    Walle Wallen Guest

    I have a strange problem. The script posted at the end off this post is
    not working properly on one of my computers. If I run it alone, it works
    just fine, but not inside one of my scripts. The script works fine on
    all other computers that I have tested. Do anyone now what could be
    causing this.

    //Walle

    It raises the following exception:
    "Exception `SocketError' at ./Handlers/ServerStatusHandler.rb:125 -
    getaddrinfo: Name or service not known"'

    The script:
    def pingecho(host, timeout=5, service="echo")
    begin
    timeout(timeout) do
    s = TCPSocket.new(host, service)
    s.close
    end
    rescue Errno::ECONNREFUSED
    return true
    rescue Timeout::Error, StandardError
    return false
    end
    return true
    end
    --
    Posted via http://www.ruby-forum.com/.
     
    Walle Wallen, Aug 2, 2010
    #1
    1. Advertising

  2. For me it seems that your failing computer is unable to resolv the ip
    address of your target host. DNS misconfiguration.

    Try to lookup the host with your operating systems tools like nslookup,
    dig, od dnsip.

    --

    Markus

    On 08/02/2010 07:03 PM, Walle Wallen wrote:
    > I have a strange problem. The script posted at the end off this post is
    > not working properly on one of my computers. If I run it alone, it works
    > just fine, but not inside one of my scripts. The script works fine on
    > all other computers that I have tested. Do anyone now what could be
    > causing this.
    >
    > //Walle
    >
    > It raises the following exception:
    > "Exception `SocketError' at ./Handlers/ServerStatusHandler.rb:125 -
    > getaddrinfo: Name or service not known"'
    >
    > The script:
    > def pingecho(host, timeout=5, service="echo")
    > begin
    > timeout(timeout) do
    > s = TCPSocket.new(host, service)
    > s.close
    > end
    > rescue Errno::ECONNREFUSED
    > return true
    > rescue Timeout::Error, StandardError
    > return false
    > end
    > return true
    > end
     
    Markus Schirp, Aug 2, 2010
    #2
    1. Advertising

  3. Walle Wallen

    Walle Wallen Guest

    Markus Schirp wrote:
    > For me it seems that your failing computer is unable to resolv the ip
    > address of your target host. DNS misconfiguration.
    >
    > Try to lookup the host with your operating systems tools like nslookup,
    > dig, od dnsip.
    >
    > --
    >
    > Markus


    Hey Markus,
    thanks for your response.

    The thing is that the script works as intended when I run it outside,
    alone in a .rb file, but not inside one
    of my scripts. The script works as intended on all my computers but one,
    which raises that exception.
    It's really strange.
    --
    Posted via http://www.ruby-forum.com/.
     
    Walle Wallen, Aug 2, 2010
    #3
  4. Walle Wallen

    Walle Wallen Guest

    Walle Wallen, Aug 2, 2010
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?SWxhbiBPc3Npbg==?=

    .Net Seems to be Causing DLL Memory Leak?

    =?Utf-8?B?SWxhbiBPc3Npbg==?=, Feb 28, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    554
    Amit Bahree
    Mar 9, 2005
  2. Bradley, Todd
    Replies:
    0
    Views:
    331
    Bradley, Todd
    Nov 16, 2004
  3. A. S. Bradbury
    Replies:
    5
    Views:
    319
    Eric Hodel
    Sep 8, 2006
  4. Baq Haidri
    Replies:
    4
    Views:
    356
    Baq Haidri
    May 7, 2008
  5. john maclean

    Ping.pingecho

    john maclean, Aug 29, 2008, in forum: Ruby
    Replies:
    1
    Views:
    108
    John Pritchard-williams
    Aug 29, 2008
Loading...

Share This Page