Pat Eyler wrote:
> My implementation of Net::Ping is attached. Criticism is welcome.
It would be good to have all the pings in one ruby basket.
Some minor fixes:
--- ping-orig.rb 2006-02-25 12:35:14.000000000 -0800
+++ ping.rb 2006-02-25 12:35:30.000000000 -0800
@@ -46,13 +46,13 @@
def ping(host)
begin
- timeout(@timeout) do
+ Timeout.timeout(@timeout) do
if @protocol == 'tcp'
s = TCPSocket.new(host, @port)
s.close
elsif @protocol == 'udp'
s = UDPSocket.new
- s.bind( "", 23000 )
+# s.bind( "", 23000 ) ## not needed, may cause conflict
s.send( "Hello\n", 0, host, @port )
msg = s.recvfrom( 100, 0 )
if msg[0] != "Hello\n"
--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407