module EtFullSystem
Constants
- VERSION
Public Class Methods
is_port_open?(port, ip: '0.0.0.0')
click to toggle source
# File lib/et_full_system.rb, line 6 def self.is_port_open?(port, ip: '0.0.0.0') s = Socket.new(Socket::AF_INET, Socket::SOCK_STREAM, 0) sa = Socket.sockaddr_in(port, ip) begin s.connect_nonblock(sa) rescue Errno::EINPROGRESS if IO.select(nil, [s], nil, 1) begin s.connect_nonblock(sa) rescue Errno::EISCONN return true rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH return false end end end return false end
os()
click to toggle source
# File lib/et_full_system/os.rb, line 4 def self.os @os ||= ( host_os = RbConfig::CONFIG['host_os'] case host_os when /mswin|msys|mingw|cygwin|bccwin|wince|emc/ :windows when /darwin|mac os/ :macosx when /linux/ :linux when /solaris|bsd/ :unix else raise "unknown os: #{host_os.inspect}" end ) end