I am trying to write a client/server application using dRuby drb-2.0b1 onWin
XP(Pro)
ruby 1.7.3 (2002-11-17) [i386-mswin32]

Got it working in a single threaded mode (see code below).
But need some help to get it multi-threaded.

I have commented out the multi-threading part because it does not work.
Any help will be highly appreciated.
Thanks,

--- shanko

# ==========================================
# Server code
require 'drb'
require 'timeout'

STDOUT.sync = true

class TstSrvr
    def initialize
        @work_threads = []
    end

    def time_now
        "It is:  " + Time.now.to_s
    end

    def work_request(owner = "", work_id = 0)
        return "Sorry, owner cannot be empty string" if owner == ""
        return "Sorry #{owner}, invalid work_id" if work_id < 1
        ret  = "Working on [" + work_id.to_s + "] from " + owner
        #t = Thread.new {
            sleep(0.1)
            puts "Start #{owner}:#{work_id}> " + `echo %TIME%`
            puts `ping localhost`
            puts "Stop  #{owner}:#{work_id}> " + `echo %TIME%`
        # }
        #@work_threads << t
        #t.join
        ret
    end

    def check_work(owner = "", work_id = 0)

    # Stub for checking if the work is over

    end

    def bye(msg="")
       puts msg

       #p @work_threads
       #@work_threads.each { |t| t.join }

       Thread.new {sleep(0.1); exit(1)}
       nil
    end
end

srvObj = TstSrvr.new

begin

        DRb.start_service("druby://localhost:5555",srvObj)
        DRb.thread.join

rescue RuntimeError
    puts 'Got runtime error: '
    puts $!
    DRb.stop_service
    retry
end

# ==========================================
## Client Code
require 'drb'

STDOUT.sync = true

begin
    DRb.start_service
    cliObj = DRbObject.new(nil,"druby://localhost:5555")

    2.times { |i|
        puts cliObj.time_now
        puts cliObj.work_request("_shanko",i+1)
        sleep(2)
    }

    # cliObj.bye('Bye Bye')

rescue RuntimeError
    puts 'Connect error:'
    puts $!
end

# ==========================================
## Code to stop the server
require 'drb'

cliObj = DRb::DRbObject.new(nil,"druby://localhost:5555")
cliObj.bye('Bye Bye')