Top Level Namespace

Defined Under Namespace

Modules: Scud

Instance Method Summary collapse

Instance Method Details

#openport?(host, port) ⇒ Boolean

FIXME: move method out of UI into a helper somewhere

Returns:

  • (Boolean)


57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/scud/ui/create_command.rb', line 57

def openport?(host,port)
  require 'socket'
  begin
    aSock = Socket.new(:INET, :STREAM)
    raw = Socket.sockaddr_in(port, host)
    if aSock.connect(raw)
      true
    end
  rescue (Errno::ECONNREFUSED)
    false
  rescue (Errno::ETIMEDOUT)
    exit_now!('timed out waiting for instance to be available.')
  end
end