Skip to content

Instantly share code, notes, and snippets.

@maveonair
Last active December 14, 2015 00:19
Show Gist options
  • Save maveonair/4998278 to your computer and use it in GitHub Desktop.
Save maveonair/4998278 to your computer and use it in GitHub Desktop.
Get bonjour information about AirVideo servers
require 'dnssd'
require 'timeout'
begin
timeout 3 do
DNSSD.browse! '_airvideoserver._tcp.', 'local' do |r|
puts "Found HTTP service: #{r.name}"
resolver = DNSSD::Service.new
resolver.resolve(r) do |resolved|
puts resolved.port
puts resolved.target
break unless resolved.flags.more_coming?
end
break unless r.flags.more_coming?
end
end
rescue Timeout::Error
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment