Created
May 10, 2010 16:34
-
-
Save sugamasao/396242 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#client.rb | |
require 'drb/drb' | |
there = DRbObject.new_with_uri("druby://localhost:12345") | |
puts there.method1("hoge") | |
there method2() do |num| | |
puts "yield = #{num}" | |
end | |
#server.rb | |
require 'drb/drb' | |
class Server | |
def method1(str) | |
STDERR.puts "call method1" | |
return ">> #{str}" | |
end | |
def method2(str) | |
STDERR.puts "call method2" | |
10.times do |num| | |
yield "#{str}.#{num}" | |
end | |
end | |
end | |
DRb.start_service("druby://localhost:12345", Server.new) | |
puts "start service..." | |
sleep |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment