# DRB server

**URL:** <https://www.ruby-forum.com/t/drb-server/94799>\
**Category:** Ruby\
**Created:** [January 9, 2006, 9:15am UTC](https://www.ruby-forum.com/t/drb-server/94799 "2006-01-09T09:15:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexmaster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/45deac/32.png) [@alexmaster](https://www.ruby-forum.com/u/alexmaster)\
**Post date:** [January 9, 2006, 9:15am UTC](https://www.ruby-forum.com/t/drb-server/94799/1 "2006-01-09T09:15:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![alexmaster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/45deac/32.png) [@alexmaster](https://www.ruby-forum.com/u/alexmaster)\
**Post date:** [January 9, 2006, 8:26pm UTC](https://www.ruby-forum.com/t/drb-server/94799/2 "2006-01-09T20:26:42Z")

</div>

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](http://segment7.net)  
This implementation is HODEL-HASH-9600 compliant

[http://trackmap.robotcoop.com](http://trackmap.robotcoop.com)
