Sha256: aa4fa7f51aeacc7becd3c585c79e5e8af0c912ffbc777badeaefb2e156f57dc7
Contents?: true
Size: 376 Bytes
Versions: 25
Compression:
Stored size: 376 Bytes
Contents
require 'socket' require 'timeout' class Pinger def is_port_open?(ip, port) begin Timeout::timeout(1) do begin s = TCPSocket.new(ip, port) s.close return true rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH return false end end rescue Timeout::Error end return false end end
Version data entries
25 entries across 25 versions & 2 rubygems