Esempio n. 1
0
        /// <summary>
        /// Connect a channel to the remote server using the 'SCP TO' command ('scp -t')
        /// </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_ConnectTo(out Channel channel, out Stream server, string rfile, bool recursive)
        {
            string scpCommand = "scp -p -t ";
            if(recursive) scpCommand += "-r ";
            scpCommand += "\""+rfile+"\"";

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

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

            SCP_CheckAck(server);
        }
Esempio n. 2
0
 protected virtual void ConnectChannel()
 {
     m_channel = m_session.openChannel(ChannelType);
     this.OnChannelReceived();
     m_channel.connect();
     this.OnConnected();
 }