需要定时自动从ftp接受文件,请给个ftp下载的源代码,万分感激

解决方案 »

  1.   

    下载文件的C#例子public static bool DisplayFileFromServer(Uri serverUri)
    {
        // The serverUri parameter should start with the ftp:// scheme.
        if (serverUri.Scheme != Uri.UriSchemeFtp)
        {
            return false;
        }
        // Get the object used to communicate with the server.
        WebClient request = new WebClient();    // This example assumes the FTP site uses anonymous logon.
        request.Credentials = new NetworkCredential ("anonymous","[email protected]");
        try 
        {
            byte [] newFileData = request.DownloadData (serverUri.ToString());
            string fileString = System.Text.Encoding.UTF8.GetString(newFileData);
            Console.WriteLine(fileString);
        }
        catch (WebException e)
        {
            Console.WriteLine(e.ToString());
        }
        return true;
    }
      

  2.   

    要vs下,vb的源码,,发到马上加分