Sha256: 7eda8843613817c9ba87e6fed5e7642e7a7b65a76bb006b31c11db04f5a4942b
Contents?: true
Size: 328 Bytes
Versions: 13
Compression:
Stored size: 328 Bytes
Contents
require 'socket' require 'timeout' module SocketHelper def is_port_open?(ip, port) begin Timeout::timeout(1) do s = TCPSocket.new(ip, port) s.close return true end rescue Timeout::Error, Errno::ECONNREFUSED, Errno::EHOSTUNREACH # don't do anything end false end end
Version data entries
13 entries across 13 versions & 1 rubygems