░▒▓████████████████████████████████▓▒░ ░▒▓█ ▓▒░ ░▒▓█ ~ S W A M P ~ ▓▒░ ░▒▓█ ▓▒░ ░▒▓████████████████████████████████▓▒░
pplmvsvm
LOCATION:
/var/www/canvas/vendor/bundle/ruby/3.1.0/gems/find_a_port-1.0.1/lib
☗ ROOT
↻ REFRESH
✎ CARVE FLESH
EDITING: find_a_port.rb
require 'socket' # Provides a utility to find an available TCP port on the local machine. module FindAPort # Returns an available port number on the local machine # # This uses a hack where we create a `TCPServer` and allow Ruby to # auto-bind an available port, ask for that port number, and then # close the server. There is a small chance that something could bind # to that port before you use it; this operation does nothing to # *reserve* the port for you. # # @return [Integer] an available TCP port number def available_port server = TCPServer.new('127.0.0.1', 0) server.addr[1] ensure server.close if server end module_function :available_port end
CANCEL
Name
Type
Size
Modified
Actions
↩ ..
DIR
—
—
📄 find_a_port.rb
RB
697 B
2023-09-24 03:47
EDIT