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