Repository is archived
No commit activity in last 3 years
No release in over 3 years
Wrapper around NSNetService for RubyMotion.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0

Runtime

 Project Readme

NetService

NetService is a simple wrapper around NSNetService. It publishes and consumes services over Bonjour.

Installation

Command Line:

gem install motion-net-service

Bundler:

gem 'motion-net-service'

Usage

Publishing a NetService (Bonjour) service:

@service = NetService.new(name: "amazaballs", port: 4321) do |ns|
  ns.on_did_publish do
    puts "I published a service"
  end
  ns.on_did_not_resolve do |error|
    puts "Oh crap, I got an error: #{error}"
  end
end

@service.publish

Consuming a service

@n = NetServiceBrowser.search('_ssh._tcp') do |service, more_coming|
  p "name: #{service.name}"
  p "service url: #{service.hostName}:#{service.port}"
  p "More coming?: #{more_coming}"
end

License

MIT, check the LICENSE file.