Here's the code again, for your convenience.  And, when I step through this,
the error in the server occurs when the client process terminates, not when
it stops its local DRb service session.

THANKS,

Ken.


-------------------- drbsvr.rb

# drb server

require 'drb'

class MySvr
 def svc(stop)
  puts "MySvr::svc called."
  return "Service completed."
 end
end

$stdout.sync=true;

while true
 begin
  puts "Starting MySvr..."
  DRb.start_service("druby://localhost:9000", MySvr.new());
  DRb.thread.join;
  puts "MySvr has terminated"
 rescue DRb::DRbConnError
  puts "Rescued DRbConnectionClosed: #{$!}"
 end
end

---------------drbclnt.rb
# drb client
require 'drb'

begin

 DRb.start_service(nil,nil);
 svr = DRbObject.new(nil, "druby://localhost:9000")
 10.times do
  puts svr.svc(false);
 end
 DRb.stop_service;

rescue DRb::DRbConnError
 puts "Rescued #{$!}"
end

------------Client output
Debug.rb
Emacs support available.

H:/qbbpo/src/vendornet/etc/
(rdb:1) c
Service completed.
Service completed.
Service completed.
Service completed.
Service completed.
Service completed.
Service completed.
Service completed.
Service completed.
Service completed.
Press any key to continue

------------ Server output & DRb error
(rdb:1) c
Starting MySvr...
MySvr::svc called.
MySvr::svc called.
MySvr::svc called.
MySvr::svc called.
MySvr::svc called.
MySvr::svc called.
MySvr::svc called.
MySvr::svc called.
MySvr::svc called.
MySvr::svc called.
e:/tools/ruby/lib/ruby/site_ruby/1.8/drb/drb.rb:104: `connection closed'
(DRb::
RbConnError)
        from e:/tools/ruby/lib/ruby/site_ruby/1.8/drb/drb.rb:596:in `start'
        from e:/tools/ruby/lib/ruby/site_ruby/1.8/drb/drb.rb:596:in `run'
        from e:/tools/ruby/lib/ruby/site_ruby/1.8/drb/drb.rb:549:in
`initialize

        from e:/tools/ruby/lib/ruby/site_ruby/1.8/drb/drb.rb:737:in `new'
        from e:/tools/ruby/lib/ruby/site_ruby/1.8/drb/drb.rb:737:in
`start_serv
ce'
        from H:/qbbpo/src/vendornet/etc/drbsvr.rb:17
e:/tools/ruby/lib/ruby/site_ruby/1.8/drb/drb.rb:104:
raise(DRbConnError, '
onnection closed') if sz.nil?
(rdb:3)

"Ken Hilton" <kenosis / comcast.net> wrote in message
news:iStmc.42859$I%1.2775243 / attbi_s51...
> Greetings,
>
> Can anyone explain to me why this very simple little DRb client server
pair
> generates a DRb::DRbConnError when the client terminates?  I've checked
out
> the books and the samples and I can't see what I'm missing.  I'm running
> Ruby 1.8.1 on Win2000 and WinXP.  The problem reproduces w/the pair
running
> on the same machine or (with the host id modified) when each is running on
> separate machines.
>
> Instructions: Run drbsvr.rb first, then run the drbclnt.rb.  The output I
> get from ruby follows below.
>
> PS. I am unable to rescue the error that was raised by DRb, which BTW
> puzzles me further.
>
> Thanks for any help you can lend.
>
> Ken.
>
> -----------------------------
> # drb server
>
> require 'drb'
>
> class MySvr
>  def svc
>   puts "MySvr::svc called."
>   return "Service completed."
>  end
> end
>
> $stdout.sync=true;
>
> while true
>  begin
>   puts "Starting MySvr..."
>   DRb.start_service("druby://localhost:9000", MySvr.new());
>   DRb.thread.join;
>   DRb.stop_service;
>  rescue DRb::DRbConnError
>   puts "Rescued DRbConnectionClosed: #{$!}"
>  end
> end
>
> ------------------------
> # drb client
> require 'drb'
>
> DRb.start_service(nil,nil);
> svr = DRbObject.new(nil, "druby://localhost:9000")
> 10.times do
>  puts svr.svc();
> end
> DRb.stop_service;
> ---------------------------
> Output:(rdb:1) c
> Starting MySvr...
> MySvr::svc called.
> MySvr::svc called.
> MySvr::svc called.
> MySvr::svc called.
> MySvr::svc called.
> MySvr::svc called.
> MySvr::svc called.
> MySvr::svc called.
> MySvr::svc called.
> MySvr::svc called.
> e:/tools/ruby/lib/ruby/site_ruby/1.8/drb/drb.rb:104: `connection closed'
> (DRb::D
> RbConnError)
>         from e:/tools/ruby/lib/ruby/site_ruby/1.8/drb/drb.rb:596:in
`start'
>         from e:/tools/ruby/lib/ruby/site_ruby/1.8/drb/drb.rb:596:in `run'
>         from e:/tools/ruby/lib/ruby/site_ruby/1.8/drb/drb.rb:549:in
> `initialize'
>
>         from e:/tools/ruby/lib/ruby/site_ruby/1.8/drb/drb.rb:737:in `new'
>         from e:/tools/ruby/lib/ruby/site_ruby/1.8/drb/drb.rb:737:in
> `start_servi
> ce'
>         from H:/qbbpo/src/vendornet/etc/drbsvr.rb:17
> e:/tools/ruby/lib/ruby/site_ruby/1.8/drb/drb.rb:104:
> raise(DRbConnError, 'c
> onnection closed') if sz.nil?
> (rdb:3)
>
>
>