Sha256: 4fc3cfc6ba93b0d3ace7278cb2c370ddc009656b137cc5dc61cd0a9e30cc4394
Contents?: true
Size: 592 Bytes
Versions: 11
Compression:
Stored size: 592 Bytes
Contents
require 'dnssd' Thread.abort_on_exception = true trap 'INT' do exit end trap 'TERM' do exit end browser = DNSSD::Service.new services = {} puts "Browsing for TCP blackjack service" puts "(run sample/register.rb)" puts browser.browse '_blackjack._tcp' do |reply| services[reply.fullname] = reply next if reply.flags.more_coming? services.sort_by do |_, service| [(service.flags.add? ? 0 : 1), service.fullname] end.each do |_, service| add = service.flags.add? ? 'Add' : 'Remove' puts "#{add} #{service.name} on #{service.domain}" end services.clear puts end
Version data entries
11 entries across 11 versions & 2 rubygems