From: brabuhr@... Date: 2011-10-05T05:07:05+09:00 Subject: Re: net ping is in error in Windows 7 OS On Mon, Oct 3, 2011 at 2:49 PM, Edward QU wrote: > Dear All > I am just want to write a program to ping my servers if them are alive, > using Ruby, but it doesnt work,  whatever the ip address I put down in > the programe, it all said ok, any advise would be great appricated. Code from an old project: def ping hosts netstatus = {} threads = ThreadGroup.new PingTCP.econnrefused = true hosts = [hosts] unless hosts.respond_to?(:each) hosts.each{ |host| threads.add Thread.new(host){ |h| unless h.hostname.to_s.size < 1 ping_obj = PingTCP.new(h.hostname.to_s, 22, 1) if ping_obj.ping? # Success pinging 'host' netstatus[h.id] = "online" else # Failed to ping 'host' netstatus[h.id] = "offline" end else netstatus[h.id] = "" end } } threads.list.each { |t| t.join } netstatus end