Class: PortProber
- Inherits:
-
Object
- Object
- PortProber
- Defined in:
- lib/proxy/port_prober.rb
Overview
lovingly reused from selenium-webdriver
Class Method Summary collapse
Class Method Details
.above(port) ⇒ Object
4 5 6 7 |
# File 'lib/proxy/port_prober.rb', line 4 def self.above(port) port += 1 until free? port port end |
.free?(port) ⇒ Boolean
9 10 11 12 13 14 |
# File 'lib/proxy/port_prober.rb', line 9 def self.free?(port) TCPServer.new('localhost', port).close true rescue SocketError, Errno::EADDRINUSE false end |