Class: DNSSD::Reply::AddrInfo
- Inherits:
-
DNSSD::Reply
- Object
- DNSSD::Reply
- DNSSD::Reply::AddrInfo
- Defined in:
- lib/dnssd/reply/addr_info.rb
Overview
Created by DNSSD::Service#getaddrinfo
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
IP address of host.
-
#hostname ⇒ Object
readonly
Host name.
-
#port ⇒ Object
readonly
Port name.
-
#ttl ⇒ Object
readonly
Time to live see #expired?.
Attributes inherited from DNSSD::Reply
Instance Method Summary collapse
-
#expired? ⇒ Boolean
Has this AddrInfo passed its TTL?.
-
#initialize(service, flags, interface, hostname, sockaddr, ttl) ⇒ AddrInfo
constructor
Creates a new AddrInfo, called internally by DNSSD::Service#getaddrinfo.
Methods inherited from DNSSD::Reply
#fullname, #inspect, #interface_name, #protocol, #service_name, #set_fullname, #set_names
Constructor Details
#initialize(service, flags, interface, hostname, sockaddr, ttl) ⇒ AddrInfo
Creates a new AddrInfo, called internally by DNSSD::Service#getaddrinfo
29 30 31 32 33 34 35 36 37 |
# File 'lib/dnssd/reply/addr_info.rb', line 29 def initialize(service, flags, interface, hostname, sockaddr, ttl) super service, flags, interface @hostname = hostname @port, @address = Socket.unpack_sockaddr_in sockaddr @created = Time.now @ttl = ttl end |
Instance Attribute Details
#address ⇒ Object (readonly)
IP address of host
9 10 11 |
# File 'lib/dnssd/reply/addr_info.rb', line 9 def address @address end |
#hostname ⇒ Object (readonly)
Host name
14 15 16 |
# File 'lib/dnssd/reply/addr_info.rb', line 14 def hostname @hostname end |
#port ⇒ Object (readonly)
Port name
19 20 21 |
# File 'lib/dnssd/reply/addr_info.rb', line 19 def port @port end |
#ttl ⇒ Object (readonly)
Time to live see #expired?
24 25 26 |
# File 'lib/dnssd/reply/addr_info.rb', line 24 def ttl @ttl end |
Instance Method Details
#expired? ⇒ Boolean
Has this AddrInfo passed its TTL?
42 43 44 |
# File 'lib/dnssd/reply/addr_info.rb', line 42 def expired? Time.now > @created + ttl end |