Sha256: 47cb4179806d27272ee7b2442adacc17c135b6d7b32a4e2df51a8a1845d6ee58

Contents?: true

Size: 440 Bytes

Versions: 26

Compression:

Stored size: 440 Bytes

Contents

require 'socket'
require 'timeout'

module Veewee
  class Utils

    def self.is_port_open?(ip, port)
      begin
        Timeout::timeout(1) do
          begin
            s = TCPSocket.new(ip, port)
            s.close
            return true
          rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH
            return false
          end
        end
		  rescue Timeout::Error
	    end

	    return false
	end


  end #Class
end #Module

Version data entries

26 entries across 26 versions & 2 rubygems

Version Path
HeSYINUvSBZfxqA-veewee-0.203.3 lib/veewee/utils.rb
HeSYINUvSBZfxqA-veewee-0.203.2 lib/veewee/utils.rb
HeSYINUvSBZfxqA-veewee-0.203.1 lib/veewee/utils.rb
veewee-0.2.3 lib/veewee/utils.rb
veewee-0.2.2 lib/veewee/utils.rb
veewee-0.2.1 lib/veewee/utils.rb
HeSYINUvSBZfxqA-veewee-0.2.0.2 lib/veewee/utils.rb
veewee-0.2.0 lib/veewee/utils.rb
veewee-0.1.29 lib/veewee/utils.rb
veewee-0.1.28 lib/veewee/utils.rb
veewee-0.1.27 lib/veewee/utils.rb
veewee-0.1.26 lib/veewee/utils.rb
veewee-0.1.25 lib/veewee/utils.rb
veewee-0.1.24 lib/veewee/utils.rb
veewee-0.1.23 lib/veewee/utils.rb
veewee-0.1.22 lib/veewee/utils.rb
veewee-0.1.21 lib/veewee/utils.rb
veewee-0.1.20 lib/veewee/utils.rb
veewee-0.1.19 lib/veewee/utils.rb
veewee-0.1.18 lib/veewee/utils.rb