DRb, remote host

- -----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. 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
(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-----

Pau Garcia i Quiles wrote:

[snip]

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.

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

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\. 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)

                              ^^^^^^^^^

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?

···

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

--
Eric Hodel - drbrain@segment7.net - http://segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com