123456789_123456789_123456789_123456789_123456789_

Class: Selenium::WebDriver::PortProber

Relationships & Source Files
Inherits: Object
Defined in: rb/lib/selenium/webdriver/common/port_prober.rb

Constant Summary

Class Method Summary

Class Method Details

.above(port)

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/common/port_prober.rb', line 23

def self.above(port)
  port += 1 until free? port
  port
end

.free?(port) ⇒ Boolean

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/common/port_prober.rb', line 33

def self.free?(port)
  Platform.interfaces.each do |host|
    TCPServer.new(host, port).close
  rescue *IGNORED_ERRORS => e
    WebDriver.logger.debug("port prober could not bind to #{host}:#{port} (#{e.message})", id: :driver_service)
    # ignored - some machines appear unable to bind to some of their interfaces
  end

  true
rescue SocketError, Errno::EADDRINUSE
  false
end