I have started developing a simple application that transfer my local files to a remote SSH server over SFTP.
My application is expected to do it programmaticly so i am planning to use Granados opensource SSH solution. In Granados test application there is a simple example like:
SSHConnectionParameter f = new SSHConnectionParameter();
f.UserName = "root";
f.Password = "";
f.Protocol = SSHProtocol.SSH2;
f.AuthenticationType = AuthenticationType.Password;
f.WindowSize = 0x1000;
Reader reader = new Reader();
Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
//s.Blocking = false;
s.Connect(new IPEndPoint(IPAddress.Parse("127.0.0.1"), 22));
_conn = SSHConnection.Connect(f, reader, s);
reader._conn = _conn;
SSHChannel ch = _conn.OpenShell(reader);
reader._pf = ch;
SSHConnectionInfo ci = _conn.ConnectionInfo;
In Granados, I couldn't find any examples which tells how to send a file.
I think there must be a simple function such as _conn.TransmitFile(sourcePath, destinationPath);
but I couldn't find any example.
Does anyone know how to send a file between servers over SSH by using C# with Granados library?
传输数据读取器._pf.Transmit(Encoding.ASCII.GetBytes(nextCommand),0,nextCommand.Length);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.