#!/usr/bin/env ruby $: << File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib')) require 'rubygems' require 'net/dns/mdns-sd' require 'net/dns/resolv-mdns' require 'net/dns/resolv-replace' master_address = nil puts 'Looking for the master node...' service = Net::DNS::MDNSSD.browse('_demo._tcp') { |r| Net::DNS::MDNSSD.resolve(r.name, r.type) do |rr| puts "Found #{rr.target}!" master_address = rr.target end } sleep 3 if master_address require 'node' node = Node.new(master_address, 9125) node.run else puts "Couldn't find a master node. Dying." end