From: Pierre Brengard Date: 2002-06-17T16:43:06+09:00 Subject: network connection test Hello, Has someone any clue to write a test to see if the network is accessible rather than this ugly method ? : require 'socket' def test_network_connection begin addr = IPSocket.getaddress TCPSocket.gethostbyname('localhost')[0] baddr = addr.sub (/\.\d+$/, ".255") puts "Broadcasting on #{baddr}" case baddr when /127\./ return false end sock = UDPSocket.open sock.send("HELLO", 0, baddr, 27666) sock.close return true rescue Exception sock.close return false end end Pierre Brengard