# DRb, remote host

**URL:** <https://www.ruby-forum.com/t/drb-remote-host/96900>\
**Category:** Ruby\
**Created:** [January 25, 2006, 12:03am UTC](https://www.ruby-forum.com/t/drb-remote-host/96900 "2006-01-25T00:03:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pau\_Garcia\_i\_Quiles](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b9e5f3/32.png) [@Pau\_Garcia\_i\_Quiles](https://www.ruby-forum.com/u/Pau_Garcia_i_Quiles)\
**Post date:** [January 25, 2006, 12:03am UTC](https://www.ruby-forum.com/t/drb-remote-host/96900/1 "2006-01-25T00:03:17Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

- -----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

Hello,

I am trying to get DRb to work between two different hosts, but I am  
unable  
to.

I have followed the PickAxe and the introductory course in  
[http://segment7.net/projects/ruby/drb/introduction.html](http://segment7.net/projects/ruby/drb/introduction.html). For example,  
this  
code:

== server.rb ==  
require ‘drb’

class TestServer  
def add(\*args)  
args.inject{ |n,v| n + v }  
end  
end

# server = TestServer.new DRb.start\_service(‘druby://localhost:9000’, server) DRb.thread.join

== client.rb ==  
require ‘drb’

# DRb.start\_service() obj = DRbObject.new(nil, ‘druby://localhost:9000’) puts “Sum is: #{obj.add(1,2,3)}”

It works fine if I start both the client and the server in the same  
computer,  
but if I start the server in host A and the client in host B (replacing  
druby://localhost:9000 with druby://hostA:9000), it does not work.

Host A and host B are able to ping each other, they do not have any  
firewall  
installed and host A’s IP and host B’s IP are both resolvable (via hosts  
file) in both machines. I have also tried using the IP instead of host  
A’s  
name.

Any tip? Do I need to make the server observable or something like?

Thank you.

* * *

Pau Garcia i Quiles  
[http://www.elpauer.org](http://www.elpauer.org)  
(En general no puedo contestar antes de 10 días)

- -----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFD1rHQ/DzYv9iGJzsRAny+AKCSx6BPakSmMKxttbzNHhmi3Z4BdwCgqSgl  
uhEWuGALF28qLPq33VzjPiM=  
=iJtE

- -----END PGP SIGNATURE-----  
-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFD1rHv/DzYv9iGJzsRAvIHAJ90H4tAwbMRF0UlAx4fIXjVdCL/CgCfckKa  
R1GwRVxK9K2m0gBoLXaR1xQ=  
=raUY  
-----END PGP SIGNATURE-----

---

<div class="post-metadata">

**Author:** ![Pau\_Garcia\_i\_Quiles](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b9e5f3/32.png) [@Pau\_Garcia\_i\_Quiles](https://www.ruby-forum.com/u/Pau_Garcia_i_Quiles)\
**Post date:** [January 26, 2006, 8:43pm UTC](https://www.ruby-forum.com/t/drb-remote-host/96900/2 "2006-01-26T20:43:45Z")

</div>

Pau Garcia i Quiles wrote:

[snip]

> Thank you.

What is the error message? I’ve had problems with that last week (it was  
a network setup problem though).

---

<div class="post-metadata">

**Author:** ![Pau\_Garcia\_i\_Quiles](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b9e5f3/32.png) [@Pau\_Garcia\_i\_Quiles](https://www.ruby-forum.com/u/Pau_Garcia_i_Quiles)\
**Post date:** [January 26, 2006, 11:54pm UTC](https://www.ruby-forum.com/t/drb-remote-host/96900/3 "2006-01-26T23:54:18Z")

</div>

On Jan 24, 2006, at 3:02 PM, Pau Garcia i Quiles wrote:

> DRb.start\_service(‘druby://localhost:9000’, server)  
> ^^^^^^^^^

This should be your external host name.

> # DRb.thread.join
> 
> == client.rb ==  
> require ‘drb’
> 
> DRb.start\_service()  
> obj = DRbObject.new(nil, ‘druby://localhost:9000’)  
> ^^^^^^^^^

This should be the remote machine’s external host name.

> # puts “Sum is: #{obj.add(1,2,3)}”
> 
> It works fine if I start both the client and the server in the same  
> computer,  
> but if I start the server in host A and the client in host B  
> (replacing  
> druby://localhost:9000 with druby://hostA:9000), it does not work.

Does DNS resolve both directions for both machines?

> Host A and host B are able to ping each other, they do not have any  
> firewall  
> installed and host A’s IP and host B’s IP are both resolvable (via  
> hosts  
> file) in both machines. I have also tried using the IP instead of  
> host A’s  
> name.

$ ruby -rsocket -e ‘p Socket.gethostname’

By that host name for each direction?

–  
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)
