Hi .. 

 On Thursday 10 February 2005 12:17, jim / freeze.org wrote:
>
> Just a quick note, your exceptions are returning true.

That doesn't seem to be the case.  Just checked with:

12:43 (kant)$ cat test2.rb
#! /usr/local/bin/ruby
require 'socket'

def alive?(host, port=80)
    t = TCPSocket.new(host, port)
    return true
  rescue Errno::ETIMEDOUT
    puts " ERR: Timed out (#{host}:#{port})"
  rescue SocketError => e
    puts " ERR: Socket problem: #{e}"
  rescue Exception => e
    puts " ERR: #{e}"
    return false
end

ip = ARGV[0]
f = alive?(ip)
if f
    puts "got to #{ip}"
else
    puts "failed (#{ip})"
end

12:45 (kant)$ ruby test2.rb "127.0.0.1"
got to 127.0.0.1

12:47 (kant)$ ruby test2.rb "foo"      
 ERR: Socket problem: getaddrinfo: hostname nor servname provided, or not 
known
failed (foo)

I just commented out the 'return false', and that makes no difference to the 
result.  So, it seems that when the exception is called, the block returns 
'nil'.  Interesting.

Thanks for your help.

Regards,

-- 
-mark.  (probertm at acm dot org)