using (SftpClient client = new SftpClient(ftpUrl, port, username, password))
{
KeyValuePair<string, CipherInfo> temp = client.ConnectionInfo.Encryptions.FirstOrDefault(e => e.Key == sftpEncryption);
if (temp.Key == sftpEncryption)
{
client.ConnectionInfo.Encryptions.Clear();
client.ConnectionInfo.Encryptions.Add(temp);
}
client.Connect();
Stream stream = null; // some data to upload
// The upload works fine but how can I see the response code (numeric code) and the response message from the server.
client.UploadFile(stream, "my_data.bin");
}
UploadFile 方法工作得很好。但是,我希望在上传完成后从 FTP 服务器获取状态代码(数字代码)和响应消息。UploadFile 方法返回 void,回调给了我一个 ulong,我认为这是上传文件的大小。我有没有机会使用这个库从服务器获取响应信息?