2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'app/app_delegate.rb', line 2
def application(application, didFinishLaunchingWithOptions:launchOptions)
@service = NetService.new(:name => "foobar", :port => 8080).tap do |ns|
ns.on_did_publish do
puts "HELLO"
end
ns.on_did_not_resolve do |error|
end
end
@service.publish
p "SEARCHING NOW."
@n = NetServiceBrowser.search('_ssh._tcp') do |service, more_coming|
p "name: #{service.name}, addresses: #{service.addresses.first}"
p "SERVICE FOUND: #{service.hostName}"
p "MORE COMING: #{more_coming}"
end
true
end
|