Forum: Ruby DRB server

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Bab383f41b560863c107dd46c1cf9092?d=identicon&s=25 alexmaster (Guest)
on 2006-01-09 09:15
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
58479f76374a3ba3c69b9804163f39f4?d=identicon&s=25 Eric Hodel (Guest)
on 2006-01-09 20:26
(Received via mailing list)
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 Hodel - drbrain@segment7.net - http://segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com
This topic is locked and can not be replied to.