Ruby New dnssd (bonjour zeroconf) service not appearing while browsing
Posted
by Poul
on Stack Overflow
See other posts from Stack Overflow
or by Poul
Published on 2010-06-03T17:41:18Z
Indexed on
2010/06/03
17:44 UTC
Read the original article
Hit count: 393
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
© Stack Overflow or respective owner