def ready?
      config.host.nil? and log_and_raise(TCPSocketCheckError, "You must supply a host!")
      config.port.nil? and log_and_raise(TCPSocketCheckError, "You must supply a port!")

      socket = TCPSocket.new(config.host, config.port)

      if config.data.nil?
        config.ui.logger.debug { "read(#{config.host}:#{config.port})" }
        ((IO.select([socket], nil, nil, config.timeout) && socket.gets) ? true : false)
      else
        config.ui.logger.debug { "write(#{config.host}:#{config.port}, #{config.data.size} bytes)" }
        ((IO.select(nil, [socket], nil, config.timeout) && socket.write(config.data)) ? true : false)
      end

    rescue Errno::ETIMEDOUT, Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::EHOSTUNREACH, Errno::EHOSTDOWN, Errno::ENETUNREACH => e
      config.ui.logger.debug { "#{config.host}:#{config.port} - #{e.message}" }
      false
    ensure
      (socket && socket.close)
    end
def ready?
      config.host.nil? and log_and_raise(TCPSocketCheckError, "You must supply a host!")
      config.port.nil? and log_and_raise(TCPSocketCheckError, "You must supply a port!")

      socket = TCPSocket.new(config.host, config.port)

      if config.data.nil?
        config.ui.logger.debug { "read(#{config.host}:#{config.port})" }
        ((IO.select([socket], nil, nil, config.timeout) && socket.gets) ? true : false)
      else
        config.ui.logger.debug { "write(#{config.host}:#{config.port}, #{config.data.size} bytes)" }
        ((IO.select(nil, [socket], nil, config.timeout) && socket.write(config.data)) ? true : false)
      end

    rescue Errno::ETIMEDOUT, Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::EHOSTUNREACH, Errno::EHOSTDOWN, Errno::ENETUNREACH => e
      config.ui.logger.debug { "#{config.host}:#{config.port} - #{e.message}" }
      false
    ensure
      (socket && socket.close)
    end
@param [Hash] configuration Configuration options hash.
 @option config [String] :host Host to connect to.
 @option config [Integer, String] :port Port to connect to.
 @option config [String] :data Data to send to host to provoke a response.
 @option config [Integer] :timeout (5) Set the IO select timeout.
 @option config [Integer] :wait (60) Set the amount of time before the wait
   method call will timeout.
 Check to see if socket on the host and port specified is ready.  This
 method will timeout and return false after the amount of seconds specified
 in *config.timeout* has passed if the socket has not become ready.

 @return [Boolean] Returns true or false depending on Whether the socket
   is ready or not.