Ruby 使用 Net::Ping 连接到指定的 TCP/UDP 端口

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

1
2
3
4
5
6
7
8
require 'rubygems'
require 'net/ping'
 
if Net::PingTCP.new('http://www.google.com/', 80).ping
  puts "Pong!"
else
  puts "No response"
end