コード例 #1
0
 protected virtual void ConnectChannel()
 {
     m_channel = m_session.openChannel(ChannelType);
     this.OnChannelReceived();
     m_channel.connect();
     this.OnConnected();
 }
コード例 #2
0
        /// <summary>
        /// Connect a channel to the remote server using the 'SCP From' command ('scp -f')
        /// </summary>
        /// <param name="channel">Will contain the new connected channel</param>
        /// <param name="server">Will contaun the new connected server I/O stream</param>
        /// <param name="rfile">The remote path on the server</param>
        /// <param name="recursive">Idicate a recursive scp transfer</param>
        protected void SCP_ConnectFrom(out AChannel channel, out Stream server, string rfile, bool recursive)
        {
            string scpCommand = "scp -f ";

            if (recursive)
            {
                scpCommand += "-r ";
            }
            scpCommand += "\"" + rfile + "\"";

            channel = (ChannelExec)m_session.openChannel(ChannelType);
            ((ChannelExec)channel).setCommand(scpCommand);

            server =
                new LibSterileSSH.CombinedStream
                    (channel.getInputStream(), channel.getOutputStream());
            channel.connect();

            //SCP_CheckAck(server);
        }