用C#连接到FTP(Linux):'操作失败'

时间:2013-04-13 06:27:11

标签: c# ftp

我想在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.

0 个答案:

没有答案