Sha256: 994ed90ed1a39191d45ca6f0d82206458c56cbc70b1710fdc1df6040f1676dd1
Contents?: true
Size: 853 Bytes
Versions: 1
Compression:
Stored size: 853 Bytes
Contents
# using the dnssd library to find running, local QLab instances require 'rubygems' require 'dnssd' Thread.abort_on_exception = true def row label, record puts "%-12s%s" % [label, record.send(label)] end def do_browse_on_service(b) DNSSD.resolve b.name, b.type, b.domain do |r| puts '*' * 40 puts "FOUND QLAB:" puts puts '-- machine --' row :name, b row :type, b row :domain, b row :interface, b puts puts '-- resolved domain --' row :target, r row :port, r row :target, r puts '*' * 40 end end browsers = [] browsers.push(DNSSD.browse('_qlab._udp.') do |b| do_browse_on_service(b) end) # browsers.push(DNSSD.browse('_qlab._tcp.') do |b| # do_browse_on_service(b) # end) trap 'INT' do browsers.map(&:stop); exit end trap 'TERM' do browsers.map(&:stop); exit end sleep
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
qcmd-0.1.16.pre2 | sample/dnssd.rb |