Ruby New dnssd (bonjour zeroconf) service not appearing while browsing
- by Poul
Here is my simple zeroconf (aka bonjour dnssd) browser. If I have other services running when I start the browser I can see it (the 'resolved to' line prints to the screen).
However, if I start up another service while this browser is running it will not appear. It just waits at the top of the block so I would expect it to enter the block once a new service is registered.
Any ideas?
require 'rubygems'
require 'dnssd'
browser = DNSSD::Service.new
browser.browse '_http._tcp.' do |reply| #<-- code seems to wait here for more services
DNSSD.resolve reply do |r|
puts "resolved to: http://#{r.target}:#{r.port}"
end
end
#example service
register_service = DNSSD::register( "My Service","_http._tcp", nil, my_port) do
puts "* Registering the service *"
end