Class: RestFtpDaemon::Launcher
- Inherits:
-
Object
- Object
- RestFtpDaemon::Launcher
- Defined in:
- lib/rest-ftp-daemon/launcher.rb
Constant Summary collapse
- LAUNCHER_PORT_TIMEOUT =
Class constants
3
- LAUNCHER_PORT_LOCALHOST =
"127.0.0.1"
Class Method Summary collapse
Class Method Details
.local_port_used?(port) ⇒ Boolean
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/rest-ftp-daemon/launcher.rb', line 9 def local_port_used? port Timeout.timeout(LAUNCHER_PORT_TIMEOUT) do begin TCPSocket.new(LAUNCHER_PORT_LOCALHOST, port).close true rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH false rescue Errno::EADDRNOTAVAIL "local_port_used: Errno::EADDRNOTAVAIL" end end rescue Timeout::Error false end |