1=begin 2 distributed Ruby --- dRuby Sample Client 3 Copyright (c) 1999-2000 Masatoshi SEKI 4=end 5 6require 'drb/drb' 7require 'drb/http' 8 9class DRbEx2 10 include DRbUndumped 11 12 def initialize(n) 13 @n = n 14 end 15 16 def to_i 17 @n.to_i 18 end 19end 20 21if __FILE__ == $0 22 there = ARGV.shift 23 unless there 24 $stderr.puts("usage: #{$0} <server_uri>") 25 exit 1 26 end 27 28 DRb::DRbConn.proxy_map['x68k'] = 'http://x68k/~mas/http_cgi.rb' 29 30 DRb.start_service() 31 ro = DRbObject.new(nil, there) 32 33 puts ro 34 p ro.to_a 35 puts ro.hello 36 p ro.hello 37 puts ro.sample(DRbEx2.new(1), 2, 3) 38 puts ro.sample(1, ro.sample(DRbEx2.new(1), 2, 3), DRbEx2.new(3)) 39 40 begin 41 ro.err 42 rescue DRb::DRbUnknownError 43 p $! 44 p $!.unknown 45 rescue RuntimeError 46 p $! 47 end 48end 49