我想在c#中连接到Ftp。
public static byte[] DownloadFile(int timeout, string ftpServer, string filePath, string username, string password)
{
var client = new FtpClient();
client.Connect(timeout, ftpServer, 21);
client.Login(timeout, username, password);
List<FtpItem> ftpItems = client.GetDirectoryList(timeout, directoryPath).ToList();
return ftpItems;
}
成功登录但我想获取文件
List<FtpItem> ftpItems = client.GetDirectoryList(timeout, directoryPath).ToList();
我收到此错误:Operation failed.
并且此回复:425 Failed to establish connection.