Class TCPSocket
In: lib/tcp_socket_extension.rb
Parent: Object

Methods

Public Class methods

[Source]

    # File lib/tcp_socket_extension.rb, line 14
14:   def self.listening_service?(options)
15:     Timeout::timeout(options[:timeout] || 20) do
16:       begin
17:         socket = TCPSocket.new(options[:host], options[:port])
18:         socket.close unless socket.nil?
19:         true
20:       rescue Errno::ECONNREFUSED, 
21:              Errno::EBADF           # Windows
22:         false
23:       end
24:     end
25:   end

[Source]

    # File lib/tcp_socket_extension.rb, line 27
27:   def self.verbose_wait
28:     puts ".\n"
29:     sleep 2
30:   end

[Source]

   # File lib/tcp_socket_extension.rb, line 6
6:   def self.wait_for_service(options)
7:     verbose_wait until listening_service?(options)
8:   end

[Source]

    # File lib/tcp_socket_extension.rb, line 10
10:   def self.wait_for_service_termination(options)
11:     verbose_wait while listening_service?(options)
12:   end

[Validate]