Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #server
- require 'drb'
- class Calculator
- def add(a, b)
- a + b
- end
- end
- calculator = Calculator.new
- DRb.start_service('druby://localhost:12345', calculator)
- DRb.thread.join
- #client
- require 'drb'
- DRb.start_service
- calculator = DRbObject.new_with_uri('druby://localhost:12345')
- result = calculator.add(5, 3)
- puts "Result of remote addition: #{result}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement