Ruby based remoting

2019-06-16 02:07栏目:技术创新

require 'drb' 

class TestServer 
    def add(*args) 
        args.inject {|n,v| n   v} 
    end 
end 

server = TestServer.new 
DRb.start_service('druby://localhost:9000', server) 
DRb.thread.join # Don't exit just yet! 

require 'drb' 
DRb.start_service() 
obj = DRbObject.new(nil, 'druby://localhost:9000') 
# Now use obj 
puts 'Sum is: #{obj.add(1, 2, 3)}' 

版权声明:本文由新浦京娱乐站_新浦京娱乐场官网_新浦京娱乐发布于技术创新,转载请注明出处:Ruby based remoting