Sha256: 0030980e3bdb75ddaf7898d80403b1d9185878afc1f3a96d92f2c84974eb6c7b

Contents?: true

Size: 566 Bytes

Versions: 7

Compression:

Stored size: 566 Bytes

Contents

require 'dnssd'

Thread.abort_on_exception = true

abort "#{$0} \"http service name\"" if ARGV.empty?

resolver = DNSSD.resolve ARGV.shift, '_http._tcp', 'local' do |reply|
  addresses = []

  service = DNSSD::Service.new
  begin
    service.getaddrinfo reply.target do |addrinfo|
      addresses << addrinfo.address
      break unless addrinfo.flags.more_coming?
    end
  ensure
    service.stop
  end

  puts "Addresses for #{reply.target}:\n#{addresses.join "\n"}"
  exit
end

trap 'INT' do resolver.stop; exit end
trap 'TERM' do resolver.stop; exit end

sleep

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
dnssd-1.4 sample/getaddrinfo.rb
dnssd-1.3.4 sample/getaddrinfo.rb
dnssd-1.3.3 sample/getaddrinfo.rb
dnssd-1.3.2 sample/getaddrinfo.rb
rackjour-0.1.8 vendor/gems/gems/dnssd-1.3.1/sample/getaddrinfo.rb
dnssd-1.3.1 sample/getaddrinfo.rb
dnssd-1.3 sample/getaddrinfo.rb