Edward Hatfield wrote: > Hello All, > > I got excited about the DRb Tuplespace example > in the 'Ruby Developers Guide' book, on page > 331 under 'Load-Balancing'. > > It looked pretty cool, so I typed in in and > *Poof* it blew up. I've double checked the > syntax and looked at the examples that came > with DRb (drb-1.3.4.2). I'm using ruby version > 1.6.6, and all I can say is: 'It doesn't seem > to work as advertised in the Book.' Sorry for that. Could you explain what for error messages you got? Perhaps a "Connection refused"? Note that you have to start a TupleSpace (e.g. rinda.rb) before starting the server app. And don't forget to pass the TupleSpace's URI to both the client and the server application. Regards, Michael > Here's the server: > #!/usr/bin/ruby > # file comp_s.rb > > require "drb" > > DRb.start_service > > ts = DRbObject.new( nil, ARGV[0] ) > > loop { > # get a request from the TupleSpace > req, a, b = ts.in( ['req', nil, nil] ) > > # compute the result > res = a * b > > # to identify the server on the client side > host = DRb.uri.split('//')[1].split(':')[0] > > # put the result back into the TupleSpace > ts.out( ['res', a, b, res, host] ) > } > > > ....and Here's the client: > #!/usr/bin/ruby > # file: comp_c.rb > > require "drb" > > DRb.start_service > > ts = DRbObject.new( nil, ARGV[0] ) > > for a in 6..9 do > for b in 3..5 do > ts.out( ['req', a, b] ) > end > end > > for a in 6..9 do > for b in 3..5 do > _, a, b, res, host = ts.in( ['res', a, b, nil, nil] ) > puts "#{a} * #{b} = #{res} (#{host})" > end > end > > > *Poof* > Any help, to get these examples working > would be appreciated. > > Thanks. > Edward. -- Michael Neumann merlin.zwo InfoDesign GmbH http://www.merlin-zwo.de