DRB server


#1

Hi!

My DRB server should print a message if a new client has connected,
maybe also with some details of this new client (IP or something like
this). Is there a function that could help my with this problem?

ALEX


#2

On Jan 9, 2006, at 12:16 AM, alexmaster wrote:

Hi!

My DRB server should print a message if a new client has connected,
maybe also with some details of this new client (IP or something like
this). Is there a function that could help my with this problem?

That should go in your front object, the one you pass to
DRb.start_server

$ cat c.rb
require ‘drb’

client = Object.new
def client.name() ‘Jimmy’ end

DRb.start_service
server = DRbObject.new nil, ARGV.shift
server.connect client

$ cat s.rb
require ‘drb’

front = Object.new
def front.connect(client)
puts “client #{client.name} connected!”
end

DRb.start_service nil, front
puts DRb.uri
DRb.thread.join

$ ruby s.rb &
[1] 22125
druby://kaa.coop.robotcoop.com:53485
$ ruby c.rb druby://kaa.coop.robotcoop.com:53485
client Jimmy connected!


Eric H. - removed_email_address@domain.invalid - http://segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com