Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > dynamic status updates using net-mdns bonjour messaging

Reply
Thread Tools

dynamic status updates using net-mdns bonjour messaging

 
 
Doug Beaver
Guest
Posts: n/a
 
      12-17-2005
hello,

i'm exploring using net-mdns 0.2 (written by sam roberts) to do some
bonjour work. i'm curious if anyone has figured out how to make a
bonjour service dynamically update its TXT record.

i'm starting to write a dummy chat client/server just to test the apis
out, and while i can easily find lists of all the servers out there, i'm
having difficulty getting my servers to broadcast updates about their
status.

here's a hack i did in order to simulate dynamic updates, i just create
a new service each time i want to send an update:

----

require 'net/dns/resolv-mdns'
require 'net/dns/resolv-replace'
require 'net/http'

args = ["service1", "_chatter._tcp", 8000, nil]

i = 0
announce = nil

loop do
announce.stop unless announce.nil?
announce = Net:NS::MDNS::Service.new(*args) do |s|
s.ttl = 5
s["status"] = i.to_s
end

i += 1
sleep 1
end

----

i'm using mdns-watch.rb from net-mdns's samples/ directory, and i see
the proper TXT updates going out, but i'm wondering if there's a way to
do this without having to stop the service every time.

i tried just doing 'announce["status"] = i.to_s' inside my loop, but i
never see updates, the only way i could make the bonjour records get
broadcast was to create a new service object every time.

does anyone have any suggestions? btw, thanks to sam for creating such
a cool module, i'm having a lot of fun working with it.

doug

--
"Contrary to what most people say, the most dangerous animal in the
world is not the lion or the tiger or even the elephant. It's a shark
riding on an elephant's back, just trampling and eating everything they
see." -- Jack Handey


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Bonjour Files? John Adams Windows 64bit 4 11-26-2007 04:57 PM
Apple Bonjour for Windows - Free software download wewa Windows 64bit 1 04-20-2006 06:48 AM
Cross-Platform Bonjour Module Ross Python 1 02-23-2006 12:34 AM
Upgrade path for MCSA:2000 Messaging to MCSA:2003 Messaging D. Young MCSA 2 04-05-2005 08:19 AM
un petit bonjour CONNIE MANCUSO Computer Support 2 12-07-2003 01:39 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57