From: Mohammad Khan Date: 2006-03-28T01:23:52+09:00 Subject: accessing object from dRuby server Here is server code: #!/usr/bin/env ruby require 'drb' location = "druby://localhost:9000" class Echo def initialize(msg=nil) @msg = msg.nil? ? "No message!" : msg end def message return @msg end end class EchoServer def initialize $stdout.puts "EchoServer Started" end def echo(msg=nil) echo = Echo.new(msg) $stdout.puts "Returning echo and its a class of '#{echo.class}'" return echo end end begin server = EchoServer.new DRb.start_service(location, server) DRb.thread.join rescue Interrupt $stdout.puts "Thank you for using EchoServer" rescue raise end And Here is my client code: #!/usr/bin/env ruby require 'drb' location = "druby://localhost:9000" DRb.start_service(nil, nil) server = DRbObject.new(nil, location) begin echo = server.echo("Hello dRuby") puts echo.class rescue SystemCallError $stdout.puts "EchoServer returned SystemCallError" rescue DRb::DRbConnError $stdout.puts "EchoServer down ... (DRb::DRbConnError)" rescue Errno::ECONNREFUSED $stdout.puts "EchoServer down ... (Errno::ECONNREFUSED)" rescue raise end After execute client script, here is my output at server end: mkhan@mkhan:~$ ruby echoserver.rb EchoServer Started Returning echo and its a class of 'Echo' and here is the output at client end: mkhan@mkhan:~/project/CPCServer$ ruby echoclient.rb DRb::DRbUnknown I was expecting at client end to see 'Echo' What I am doing wrong? Any help would be greatly appreciated. Thanks, Mohammad