From: kilim Date: 2005-10-01T02:36:45+09:00 Subject: Net::SSH & passing session Hello, I can make a connection using the examples provided in the documentation. But if I try to make it more 'clean', as shown bellow, I get the session returned, but I can't seem to do anything with it. Can you help me with this ? Thanks ! This is the code: require 'net/ssh' class MySSH def initialize(host, port, user, password) @host = host @port = port @user = user @password = password end def myConnection begin session = Net::SSH::Session.new(@host, @port, @user, @password ) rescue SocketError raise(IOError, 'Could not connect to host') rescue Net::SSH::AuthenticationFailed raise(IOError, 'Authentication Failed') end return session end end # of class a = MySSH.new( "localhost", 22, "aaa", "bbb" ) puts "from inspect #{a.inspect}" # here you see that session is being returned puts "the value of a.myConnection is: #{a.myConnection}" # just to double check if a.myConnection.open? puts "yep, connection is OPEN" end # Now this stuff below don't get 'seen' at all # and that is the real problem # How do I use the session once I pass it ? # ----------------------------------------- a.myConnection.open_channel do |channel| puts "open now, closing" channel.close end a.myConnection.loop