Class: Devup::PortChecker

Inherits:
Object
  • Object
show all
Defined in:
lib/devup/port_checker.rb

Overview

TODO we should use this to check ports are ready

Instance Method Summary collapse

Instance Method Details

#call(port) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/devup/port_checker.rb', line 7

def call(port)
  s = TCPSocket.new("0.0.0.0", port)
  s.write "1"
  s.close

  true
rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH
  false
end