/// <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 Channel 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 Fireball.Streams.CombinedStream (channel.getInputStream(), channel.getOutputStream()); channel.connect(); //SCP_CheckAck(server); }
/// <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 Fireball.Streams.CombinedStream (channel.getInputStream(), channel.getOutputStream()); channel.connect(); SCP_CheckAck(server); }