Class: TCPSocket
- Inherits:
-
Object
- Object
- TCPSocket
- Defined in:
- lib/selenium-grid/lib/ruby/tcp_socket_extensions.rb
Class Method Summary collapse
Class Method Details
.wait_for_service(options) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/selenium-grid/lib/ruby/tcp_socket_extensions.rb', line 6 def self.wait_for_service() socket = nil Timeout::timeout([:timeout] || 20) do loop do begin socket = TCPSocket.new([:host], [:port]) return rescue Errno::ECONNREFUSED, Errno::EBADF # Windows puts ".\n" sleep 2 end end end ensure socket.close unless socket.nil? end |