Class: Socket
Overview
OpenC3 specific additions to the Ruby Socket class
Constant Summary collapse
- IP_MULTICAST_IF =
Define needed constants for Windows
9
- IP_MULTICAST_TTL =
10
Class Method Summary collapse
-
.get_own_ip_address ⇒ String
The IP address of the current machine.
-
.lookup_hostname_from_ip(ip_address) ⇒ String
The hostname of the given IP address or ‘UNKNOWN’ if the lookup fails.
Class Method Details
.get_own_ip_address ⇒ String
Returns The IP address of the current machine.
29 30 31 |
# File 'lib/openc3/core_ext/socket.rb', line 29 def self.get_own_ip_address Resolv.getaddress Socket.gethostname end |
.lookup_hostname_from_ip(ip_address) ⇒ String
Returns The hostname of the given IP address or ‘UNKNOWN’ if the lookup fails.
36 37 38 39 40 |
# File 'lib/openc3/core_ext/socket.rb', line 36 def self.lookup_hostname_from_ip(ip_address) return Resolv.getname(ip_address) rescue return 'UNKNOWN' end |