Class: TCPSocket
- Inherits:
-
Object
- Object
- TCPSocket
- Defined in:
- lib/tcp_socket_extension.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 |
# File 'lib/tcp_socket_extension.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 puts ".\n" sleep 2 end end end ensure socket.close unless socket.nil? end |