Class: Vbox::Utils
- Inherits:
-
Object
- Object
- Vbox::Utils
- Defined in:
- lib/vbox/utils.rb
Class Method Summary collapse
Class Method Details
.is_port_open?(ip, port) ⇒ Boolean
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/vbox/utils.rb', line 7 def self.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 |