From: Tobias DiPasquale Date: 2001-11-18T01:03:44+09:00 Subject: [ruby-talk:25714] Re: more than one object in a druby server? Thanks!! Both ideas are good and just what I was looking for! Now, to decide which one to use..:-\ Thanks again :) Michael Neumann wrote: > [ruby-talk:25707] Re: more than one object in a druby server? > Tobias DiPasquale wrote: > >>Hi all, >> >> Does anyone know of a way to attach more than one object to a druby >>server? What I want to do is have clients make requests to the server to >>get references to other remote objects so that methods could be called >>on them as well. Any ideas? >> > > What about this little name server? > > require "drb/drb" > > class Registry > def initialize > @hash = {} > end > > def [](key) > @hash[key] > end > > def []=(key, val) > @hash[key] = val > end > end > > reg = Registry.new > reg["firstObject"] = String.new "Test" > reg["otherObject"] = Array.new > > primary = DRb::DRbServer.new("druby://0.0.0.0:5555", reg) > puts primary.uri > primary.thread.join > > > The client can now call [] on the remote object to get a reference to one > of the two registered objects. > > > >>P.S. Would 'rinda' be any help? If so, what is 'rinda'? Sounds like it >>might be the thing, but can't find any docs on it. (don't speak Japanese) >> >>-- >> >>0100001101000010010000110100011101110101 >><< Tobias DiPasquale >> >>-=[ Solaris Systems Administrator ]=- >>Villanova University ECE Dept. >>mailto: anany@ece.vill.edu >>-=[ Applications Engineering Consultant ]=- >>BCS Solutions, Inc. >>mailto: tdipasquale@bcssinc.com >>0100001101000010010000110100011101110101 >> >> > -- Tobias DiPasquale Solaris System Administrator Electrical and Computer Engineering Dept. Villanova University mailto: anany@ece.vill.edu tel: 610-519-5109