[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

DRB server

alexmaster

1/9/2006 8:16:00 AM

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

--
Posted via http://www.ruby-....


1 Answer

Eric Hodel

1/9/2006 7:24:00 PM

0

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://se...
This implementation is HODEL-HASH-9600 compliant

http://trackmap.rob...