Module: SporkDebugger::NetworkHelpers

Included in:
EachRunState, PreloadState
Defined in:
lib/spork/ext/ruby-debug.rb

Instance Method Summary collapse

Instance Method Details

#find_port(starting_with) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/spork/ext/ruby-debug.rb', line 30

def find_port(starting_with)
  port = starting_with
  begin
    server = TCPServer.new(HOST, port)
    server.close
  rescue Errno::EADDRINUSE
    port += 1
    retry
  end

  port
end