step 1:先安装ruby的gem:net—ping(用命令:gem install net-ping)
step 2 :使用net类里面的ping类时,用require ‘net/ping’
step 3 : 在调用时,通过 puts Net::Ping::TCP.new('IP address or host','http').ping?打印出此地址是否能ping通。(注意大小写哟)
step 1:先安装ruby的gem:net—ping(用命令:gem install net-ping)
step 2 :使用net类里面的ping类时,用require ‘net/ping’
step 3 : 在调用时,通过 puts Net::Ping::TCP.new('IP address or host','http').ping?打印出此地址是否能ping通。(注意大小写哟)