Sha256: cb893a2f70533d26e969dc953a73ba790316da354a11acb224ee38030efacaa7

Contents?: true

Size: 949 Bytes

Versions: 9

Compression:

Stored size: 949 Bytes

Contents

##
# Returned by DNSSD::Service#browse

class DNSSD::Reply::Browse < DNSSD::Reply

  ##
  # A domain for registration or browsing

  attr_reader :domain

  ##
  # The service name

  attr_reader :name

  ##
  # The service type

  attr_reader :type

  ##
  # Creates a new Browse, called internally by DNSSD::Service#browse

  def initialize(service, flags, interface, name, type, domain)
    super service, flags, interface

    set_names name, type, domain
  end

  ##
  # Resolves this service's target using DNSSD::Reply::Resolve#connect which
  # connects, returning a TCP or UDP socket.

  def connect(family = Socket::AF_UNSPEC, addrinfo_flags = 0)
    value = nil

    DNSSD.resolve! self do |reply|
      value = reply
      break
    end

    value.connect family, addrinfo_flags
  end

  def inspect # :nodoc:
    "#<%s:0x%x %p interface: %s flags: %p>" % [
      self.class, object_id, fullname, interface_name, @flags
    ]
  end

end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
dnssd-2.0.1 lib/dnssd/reply/browse.rb
dnssd-2.0 lib/dnssd/reply/browse.rb
dnssd-1.4 lib/dnssd/reply/browse.rb
dnssd-1.3.4 lib/dnssd/reply/browse.rb
dnssd-1.3.3 lib/dnssd/reply/browse.rb
dnssd-1.3.2 lib/dnssd/reply/browse.rb
rackjour-0.1.8 vendor/gems/gems/dnssd-1.3.1/lib/dnssd/reply/browse.rb
dnssd-1.3.1 lib/dnssd/reply/browse.rb
dnssd-1.3 lib/dnssd/reply/browse.rb