I've been doing some testing with Ruby drb. I have the following code (just the example code found on the ruby docs)
SERVER:
require 'drb/drb'
URI="druby://:9000"
class TimeServer
def get_current_time
return Time.now
end
end
FRONT_OBJECT=TimeServer.new; $SAFE = 1
DRb.start_service(URI, FRONT_OBJECT)
DRb.thread.join
CLIENT:
require 'drb/drb'
SERVER_URI="druby://private-ip:9000"
DRb.start_service
timeserver = DRbObject.new_with_uri(SERVER_URI)
puts timeserver.get_current_time
This works if we're both connected to the same router (and share the same private-ip x.x.x.151 and x.x.x.155 for instance).
But, when we're testing on machines miles apart and changing the server URI to SERVER_URI="druby://public-ip-of-server:9000"
on the client side, we're getting a connection timeout.
Does anyone know the solution? Port forwarding on the router is not an option.