<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          C# FTP Library

          聯(lián)合創(chuàng)作 · 2023-09-29 09:25

          這個(gè)庫(kù)基于C#和.Net框架,它很好的包裝了WININET.DLL的FTP功能,建立了一種有效的與FTP服務(wù)器交互的方式。

          示例代碼:

          using (FtpConnection ftp = new FtpConnection("ftpserver", "username", "password"))
          {
          	
          	ftp.Open(); /* Open the FTP connection */
          	ftp.Login(); /* Login using previously provided credentials */
          
          	if (ftp.DirectoryExists("/incoming")) /* check that a directory exists */
          		ftp.SetCurrentDirectory("/incoming"); /* change current directory */
          
          	if (ftp.FileExists("/incoming/file.txt"))  /* check that a file exists */
          		ftp.GetFile("/incoming/file.txt", false); /* download /incoming/file.txt as file.txt to current executing directory, overwrite if it exists */
          
          	//do some processing
          
          	try
          	{
          		ftp.SetCurrentDirectory("/outgoing");
          		ftp.PutFile(@"c:\localfile.txt", "file.txt"); /* upload c:\localfile.txt to the current ftp directory as file.txt */
          	}
          	catch (FtpException e)
          	{
          		Console.WriteLine(String.Format("FTP Error: {0} {1}", e.ErrorCode, e.Message));
          	}
          
          	foreach(var dir in ftp.GetDirectories("/incoming/processed"))
          	{
          		Console.WriteLine(dir.Name);
          		Console.WriteLine(dir.CreationTime);
          		foreach (var file in dir.GetFiles())
          		{
          			Console.WriteLine(file.Name);
          			Console.WriteLine(file.LastAccessTime);
          		}
          	}
          }
          瀏覽 23
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          評(píng)論
          圖片
          表情
          推薦
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  国产精品77777 | 天天撸 天天操 | 日韩成人三级视频网站 | 成年人网站在线 | 久久综合se婷婷 |