Class: Portchecker::Check
- Inherits:
-
Object
- Object
- Portchecker::Check
- Defined in:
- lib/portchecker.rb
Overview
Docs to follow
Class Method Summary collapse
Class Method Details
.port_open?(address, port) ⇒ Boolean
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/portchecker.rb', line 16 def self.port_open?(address, port) begin Timeout.timeout(1) do begin TCPSocket.new(address, port).close return true rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH, Errno::EADDRNOTAVAIL, SocketError # sleep(sleep_period) # retry return false end end rescue Timeout::Error return false end false end |