Sha256: 288a3737acb22dfb87b919338218f00a98e9fdabf3f104f785ad9b8cdd5ccd9a

Contents?: true

Size: 652 Bytes

Versions: 40

Compression:

Stored size: 652 Bytes

Contents

module Procemon
  class << self

    def get_port(mint_port,max_port,host="0.0.0.0")

      require 'socket'
      mint_port= mint_port.to_i
      begin
        server = TCPServer.new(host, mint_port)
        server.close
        return mint_port
      rescue Errno::EADDRINUSE
        if mint_port < max_port
          pmint_portort = (mint_port.to_i + 1)
          retry
        end
      end

    end

    def port_open?(port,host="0.0.0.0")

      require 'socket'
      begin
        server = TCPServer.new(host, port.to_i)
        server.close
        return true
      rescue Errno::EADDRINUSE
        return false
      end

    end

  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
procemon-1.2.1 lib/procemon/function/port.rb
procemon-1.2.0 lib/procemon/function/port.rb
procemon-1.1.1 lib/procemon/function/port.rb
procemon-1.0.4 lib/procemon/function/port.rb
procemon-1.0.3 lib/procemon/function/port.rb
procemon-1.0.1 lib/procemon/function/port.rb
procemon-1.0.0 lib/procemon/function/port.rb
procemon-0.9.1 lib/procemon/function/port.rb
procemon-0.9.0 lib/procemon/function/port.rb
procemon-0.8.1 lib/procemon/function/port.rb
procemon-0.8.0 lib/procemon/function/port.rb
procemon-0.7.0 lib/procemon/function/port.rb
procemon-0.6.3 lib/procemon/function/port.rb
procemon-0.6.2 lib/procemon/function/port.rb
procemon-0.6.1 lib/procemon/function/port.rb
procemon-0.5.0 lib/procemon/function/port.rb
procemon-0.4.5 lib/procemon/function/port.rb
procemon-0.4.4 lib/procemon/function/port.rb
procemon-0.4.3 lib/procemon/function/port.rb
procemon-0.4.2 lib/procemon/function/port.rb