From: "Grzegorz M." Date: 2011-10-05T22:12:02+09:00 Subject: net-ssh problem with port forwarding Hello! I'm trying to forward few ports via ssh - this is only reason I use net::ssh. I've tried following code on windows - both newest ruby 1.8.7 and 1.9.2 from rubyinstaller. log = Logger.new(STDOUT) ssh = Net::SSH.start($sshconfig["sshhost"], $sshconfig["sshaccount"], {:port => $sshconfig["sshport"], :config => false, :key_data => [$sshconfig["sshkey"]], :keys_only => true, :logger => log}) ssh.forward.local(222, "10.213.0.6", 223) ssh.forward.remote(222, "localhost", 10000) ssh.loop { true } It works, but each time I try to connect to localhost:222 from windows, OR localhost:222 on remote server, I get following error: E, [2011-10-05T15:08:45.343750 #29848] ERROR -- net.ssh.connection.session[b93ed 4]: channel_open_failed: 1 2 Connection refused E, [2011-10-05T15:08:45.343750 #29848] ERROR -- net.ssh.connection.channel[b7204 0]: could not establish direct channel: Connection refused (2) C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.2.1/lib/net/ssh/ruby_compat.rb:22: in `select': closed stream (IOError) from C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.2.1/lib/net/ssh/ruby_ compat.rb:22:in `io_select' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.2.1/lib/net/ssh/conne ction/session.rb:201:in `process' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.2.1/lib/net/ssh/conne ction/session.rb:161:in `block in loop' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.2.1/lib/net/ssh/conne ction/session.rb:161:in `loop' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.2.1/lib/net/ssh/conne ction/session.rb:161:in `loop' from test.rb:44:in `
' I understand, what's that mean - there is nothing listening on the other side of forwarded connection - BUT why it crashes with so bizzare exception? I expect in my code this to by not so uncommon situation - I forward remote port to local service, which is ie.: restarting in this particualr moment. Then - bam! Whole app is crashing. Is that a bug? Or maybe I just don't know how to tell net-ssh to ignore such errors, log it and continue loop? Any ideas? -- Posted via http://www.ruby-forum.com/.