class DNSSD::Reply::AddrInfo

Created by DNSSD::Service#getaddrinfo

Attributes

address[R]

IP address of host

hostname[R]

Host name

port[R]

Port name

ttl[R]

Time to live see expired?

Public Class Methods

new(service, flags, interface, hostname, sockaddr, ttl) click to toggle source

Creates a new AddrInfo, called internally by DNSSD::Service#getaddrinfo

Calls superclass method DNSSD::Reply.new
# 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

Public Instance Methods

expired?() click to toggle source

Has this AddrInfo passed its TTL?

# File lib/dnssd/reply/addr_info.rb, line 42
def expired?
  Time.now > @created + ttl
end