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.

It won't connect. I tried it with a friend 400 miles away, and I tried
it on 2 comps here on my home network. I get a DRbConnError no matter
what variation I try. Firewall off/on, port forwarding and port
triggering off/on. The server and client snippets of relevance are
below.
#SERVER
<snip>
$uri = "druby://localhost:7824"
if $0 == __FILE__
theApp = FXApp.new
$server = STCCGServer.new(theApp, "GameServer")
thr = Array.new
thr << Thread.new do
theApp.create
$server.show
theApp.run
end
DRb.start_service($uri, $server.game)
thr << DRb.thread
thr.each{|thread| thread.join}
end
#CLIENT
<snip>
$port = 7824
join.connect(SEL_COMMAND) do
self.hide
owner.name = namefield.text
owner.game = DRbObject.new(nil, "druby://#{ipfield.text}:#{$port}")
File.open($deck_dir + filefield.text.strip, "r"){|file|
owner.game.add_player(namefield.text, file.gets)}
sleep(1) until owner.game.game_start
owner.make_interface
end
When I run the server and client on my machine, things work. When I run
the client and server on seperate machines listed above, I get
DRbConnError. Something so widely used like DRb must work, so I can
only assume I've made an error somewhere and I have no idea what it is.
Thanks,
Raj

On Sun, Apr 15, 2007 at 02:54:45PM +0900, Raj Sahae wrote:
> It won't connect. I tried it with a friend 400 miles away, and I tried> it on 2 comps here on my home network. I get a DRbConnError no matter> what variation I try. Firewall off/on, port forwarding and port> triggering off/on. The server and client snippets of relevance are below.
You've missed out the most important bit, which is a description of your
home network *and* your friend's network.
If both are on private IP addresses, and both have NAT firewalls between
them and the Internet, then unless you've set up a VPN linking the two
networks then it's not going to be straightforward to implement, because
DRb
involves calls in both directions.
There are some details about how DRb works at
http://wiki.rubygarden.org/Ruby/page/show/DRbTutorial> #SERVER> <snip>> $uri = "druby://localhost:7824"
That is never going to work between hosts, because you've explicitly
told
the server to listen on interface 127.0.0.1 (the loopback), which means
that
only other processes on the same host will be able to connect to it.
You could try:
$uri = "druby://myhostname.example.com:7824"
That may work but only if both machines are *directly* connected to the
Internet with a public IP address (e.g. it's a Windows machine with a
USB-ADSL modem or a dial-up) *and* both machines have a real hostname,
as
the hostname is used by one machine to contact the other.
If not, then you will have to do lots of frigs involving port forwarding
*and* name to IP mapping. It would be easier to set up an ssh tunnel
between
the two machines, and run DRb over that, since only one piece of
port-forwarding would be neeed.
Regards,
Brian.

Brian Candler wrote:
>> If not, then you will have to do lots of frigs involving port forwarding>> *and* name to IP mapping. It would be easier to set up an ssh tunnel between>> the two machines, and run DRb over that, since only one piece of>> port-forwarding would be neeed.>>>> Regards,>>>> Brian
That all makes a good amount of sense. My follow up question would be
that since I'm doing this on a WinXP machine, would it be easier for me
to try the VPN route instead of setting up SSH tunneling? On *nix it
seems like ssh can be set up instantly, but I have no idea how it would
be done quickly and efficiently (and then coded for automation) on a
windows machine. I don't know how to automate VPN either, but on XP,
setting up VPN seems to take only 1 minute of clicking the mouse.
Raj

From: "Raj Sahae" <rajsahae@gmail.com>
> be done quickly and efficiently (and then coded for automation) on a> windows machine. I don't know how to automate VPN either, but on XP,> setting up VPN seems to take only 1 minute of clicking the mouse.
Hi,
I don't know the legalities of this, but it may be possible to
distribute the minimal set of cygwin binarires to provide ssh.
cygwin1.dll cygssl*.dll openssl.exe ssh.exe (...etc?)
I'm not a lawyer, etc., so I could be wrong, but it seems like the
license http://cygwin.com/licensing.html would allow distributing
a subset of the binaries without the whole installer.
Regards,
Bill

Bill Kelly wrote:
>> be that since I'm doing this on a WinXP machine, would it be easier> distribute the minimal set of cygwin binarires to provide ssh.> Bill>>>>
I apologize for this having become a little off topic. Can anyone
confirm what Bill is saying? How would I go about getting those
specific binaries, and then how would I use them? Is there a way to
integrate them with ruby. Could I create my own SSH gem or SSH module
somehow?
Raj

From: "Raj Sahae" <rajsahae@gmail.com>
>>> That all makes a good amount of sense. My follow up question would>> I don't know the legalities of this, but it may be possible to> specific binaries, and then how would I use them? Is there a way to> integrate them with ruby. Could I create my own SSH gem or SSH module> somehow?
Note also that ruby already has Net::SSH:
http://rubyforge.org/projects/net-ssh/
Maybe Net::SSH can even do port-forwarding... I don't know, though.
Regards,
Bill

Raj Sahae wrote:
> I apologize for this having become a little off topic. Can anyone> confirm what Bill is saying? How would I go about getting those> specific binaries, and then how would I use them?
Go to the Cygwin homepage, and download the installer. Select what you
need (a bit of familiarity with Linux wouldn't hurt), and wait for the
download and installation to complete.
You can then redistribute it as long as you confirm to the GPL (or write
up installation instructions, if you don't feel safe), and / or just
redistribute the installer. It's the GPL, so you should be safe if you
don't modify the Cygwin source and redistribute that.
> Is there a way to> integrate them with ruby. Could I create my own SSH gem or SSH module> somehow?
There's already an SSH gem (gem install net-ssh). You need Cygwin only
to setup an SSH server on your side, and don't have to hack it up that
much.
I have no idea, though, if this SSH server can interact with stuff
outside of Cygwin, or if you have to compile Ruby within the Cygwin
environment.
--
Phillip "CynicalRyan" Gawlowski
http://cynicalryan.110mb.com/http://clothred.rubyforge.org
Rules of Open-Source Programming:
22. Backward compatibility is your worst enemy.
23. Backward compatibility is your users' best friend.

On 4/16/07, Phillip Gawlowski <cmdjackryan@googlemail.com> wrote:
> You can then redistribute it as long as you confirm to the GPL (or write>>> 22. Backward compatibility is your worst enemy.>> 23. Backward compatibility is your users' best friend.>
Ruby Net::SSH can do port forwarding,
http://net-ssh.rubyforge.org/chapter-6.html
Although I am not sure, if it will fit your needs.

On Mon, Apr 16, 2007 at 06:51:42AM +0900, Raj Sahae wrote:
> That all makes a good amount of sense. My follow up question would be> that since I'm doing this on a WinXP machine, would it be easier for me> to try the VPN route instead of setting up SSH tunneling?
If one end is WinXP and the other Unix, then run 'putty.exe' on the
WinXP
end. It does port forwarding.
If both ends are WinXP then it's more difficult. A VPN solution like
OpenVPN
or TINC may suit you better.
Regards,
Brian.