1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| try
{
var key = new PrivateKeyFile(@"C:\testcreation\sshh");
using (SftpClient client = new SftpClient("ccur.univ-reunion.fr", 22, "jdurand1", key))
{
client.Connect();
Stream stream = File.OpenWrite(@"E:\testscp\");
client.DownloadFile("/labos/lacy/jdurand1/testscp/aa.txt", stream);
stream.Close();
client.Disconnect();
}
}
catch
{
var consoleOut = new StringWriter();
Console.SetOut(consoleOut);
Console.WriteLine("Error: {0}", e);
textBox1.Text += consoleOut.ToString();
textBox1.Refresh();
} |
Partager