#!/usr/bin/env ruby -w # simple_service.rb # A simple DRb service # load DRb require 'drb' # start up the DRb service DRb.start_service nil, [] # We need the uri of the service to connect a client puts DRb.uri # wait for the DRb service to finish before exiting DRb.thread.join
output: druby://donatello.mydomain.com:47159
#!/usr/bin/env ruby -w # simple_client.rb # A simple DRb client require 'drb' DRb.start_service # attach to the DRb server via a URI given on the command line remote_array = DRbObject.new nil, ARGV.shift puts remote_array.size remote_array << 1 puts remote_array.size
from the command line
> ./simple_client.rb druby://192.168.1.10:47159
output:
0
1
Note: I substituted the domain name with the ip address because the name in question was not stored within the DNS settings.
Reference: Introduction to Distributed Ruby (DRb) [segment7.net]