#!/usr/bin/env ruby $: << File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib')) require 'rubygems' require 'net/dns/mdns-sd' master_address = nil puts 'Looking for the master node...' service = Net::DNS::MDNSSD.browse('_demo._tcp') { |r| puts "Found #{r.name}!" master_address = r.name } 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