C# .NET 利用 Renci.SshNet 上传文件到 SFTP

using (var client = new SftpClient("Host", 22, "UserName", "Password"))
{
	client.Connect();
	try
	{
		var data = File.ReadAllBytes("C:\\test.zip")
		using (SftpFileStream sw = client.OpenWrite("/home/test.zip"))
		{
			sw.Write(data, 0, data.Length);
		}
	}
	catch(Exception ex)
	{
		throw ex;
	}
	finally
	{
		client.Disconnect();
	}
}
—— 完 ——
相关推荐
评论

立 为 非 似

中 谁 昨 此

宵 风 夜 星

。 露 , 辰

文章点击榜

细 无 轻 自

如 边 似 在

愁 丝 梦 飞

。 雨 , 花