Forum: Ruby DRb, remote host

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
5acffb3fde70f28b9eab13eb78a25e63?d=identicon&s=25 Pau Garcia i Quiles (Guest)
on 2006-01-25 00:03
(Received via mailing list)
-----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. 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-----
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFD1rHv/DzYv9iGJzsRAvIHAJ90H4tAwbMRF0UlAx4fIXjVdCL/CgCfckKa
R1GwRVxK9K2m0gBoLXaR1xQ=
=raUY
-----END PGP SIGNATURE-----
428f96cc689eb7419bba3a8bbfcc222a?d=identicon&s=25 Stefan Mahlitz (Guest)
on 2006-01-26 20:43
(Received via mailing list)
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).
58479f76374a3ba3c69b9804163f39f4?d=identicon&s=25 Eric Hodel (Guest)
on 2006-01-26 23:54
(Received via mailing list)
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 Hodel - drbrain@segment7.net - http://segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com
This topic is locked and can not be replied to.