Sha256: c35c3d545f97f9f63875d852d7b6684f49811e636ba1a708c745d18dbfa40373
Contents?: true
Size: 753 Bytes
Versions: 5
Compression:
Stored size: 753 Bytes
Contents
require 'dnssd' Thread.abort_on_exception = true trap 'INT' do exit end trap 'TERM' do exit end class ChatNameResolver def self.resolve_add(reply) Thread.new reply do |reply| DNSSD.resolve reply.name, reply.type, reply.domain do |resolve_reply| puts "Adding: #{resolve_reply.inspect}" break end end end def self.resolve_remove(reply) Thread.new reply do |reply| DNSSD.resolve reply.name, reply.type, reply.domain do |resolve_reply| puts "Removing: #{resolve_reply.inspect}" break end end end end DNSSD.browse '_presence._tcp' do |reply| if reply.flags.add? then ChatNameResolver.resolve_add reply else ChatNameResolver.resolve_remove reply end end sleep
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
dnssd-3.0.2 | sample/resolve_ichat.rb |
dnssd-3.0.1 | sample/resolve_ichat.rb |
dnssd-3.0.0 | sample/resolve_ichat.rb |
dnssd-2.0.1 | sample/resolve_ichat.rb |
dnssd-2.0 | sample/resolve_ichat.rb |