[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: DRb, remote host

Eric Hodel

1/26/2006 10:54:00 PM

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

> 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://se.../projects/ruby/drb/introdu.... 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?

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

http://trackmap.rob...