亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ftpconnection.cs

?? 這是用C#編寫的免費的 .NET FTP客戶端庫。
?? CS
?? 第 1 頁 / 共 2 頁
字號:
using System;
using System.Net;
using System.IO;
using System.Text;
using System.Net.Sockets;
using System.Collections;
using System.Data;
using System.Threading;

namespace FTPClient
{
	/// <summary>
	/// Summary description for FTPConnection.
	/// </summary>

	public class FTPConnection
	{		
		private TcpClient tcpClient;
		private static int BLOCK_SIZE = 512;
		private static int DEFAULT_REMOTE_PORT = 21;
		private static int DATA_PORT_RANGE_FROM = 1500;
		private static int DATA_PORT_RANGE_TO = 65000;
		private FTPMode mode;
		private int activeConnectionsCount;
		private string remoteHost;

		private ArrayList messageList = new ArrayList();
		private bool logMessages;

		public FTPConnection()
		{
			this.activeConnectionsCount = 0;
			this.mode = FTPMode.Active;
			this.logMessages = false;
		}

		public ArrayList MessageList
		{
			get
			{
				return this.messageList;
			}
		}

		public bool LogMessages
		{
			get
			{
				return this.logMessages;
			}

			set
			{
				if(!value)
				{
					this.messageList = new ArrayList();
				}

				this.logMessages = value;
			}
		}

		public virtual void Open(string remoteHost, string user, string password)
		{
			Open(remoteHost, DEFAULT_REMOTE_PORT, user, password, FTPMode.Active);
		}

		public virtual void Open(string remoteHost, string user, string password, FTPMode mode)
		{
			Open(remoteHost, DEFAULT_REMOTE_PORT, user, password, mode);
		}

		public virtual void Open(string remoteHost, int remotePort, string user, string password)
		{
			Open(remoteHost, remotePort, user, password, FTPMode.Active);
		}
		
		public virtual void Open(string remoteHost, int remotePort, string user, string password, FTPMode pMode)
		{
			ArrayList tempMessageList = new ArrayList();
			int returnValue;

			this.mode = pMode;
			this.tcpClient = new TcpClient();
			this.remoteHost = remoteHost;

			// As we cannot detect the local address from the TCPClient class, convert "127.0.0.1" and "localhost" to
            // the DNS record of this machine; this will ensure that the connection address and the PORT command address
            // are identical.  This fixes bug 854919.
			if (remoteHost == "localhost" || remoteHost == "127.0.0.1")
			{
				remoteHost = GetLocalAddressList()[0].ToString();
			}

			//CONNECT
			try
			{
				this.tcpClient.Connect(remoteHost, remotePort);
			}
			catch(Exception)
			{
				throw new IOException("Couldn't connect to remote server");
			}
			tempMessageList = Read();
			returnValue = GetMessageReturnValue((string)tempMessageList[0]);
			if(returnValue != 220)
			{
				Close();
				throw new Exception((string)tempMessageList[0]);
			}

			//SEND USER
			tempMessageList = SendCommand("USER " + user);
			returnValue = GetMessageReturnValue((string)tempMessageList[0]);
			if(!(returnValue == 331 || returnValue == 202))
			{
				Close();
				throw new Exception((string)tempMessageList[0]);
			}

			//SEND PASSWORD
			if(returnValue == 331)
			{
				tempMessageList = SendCommand("PASS " + password);
				returnValue = GetMessageReturnValue((string)tempMessageList[0]);
				if(!(returnValue == 230 || returnValue == 202))
				{
					Close();
					throw new Exception((string)tempMessageList[0]);
				}
			}
		}

		public virtual void Close()
		{
			ArrayList messageList = new ArrayList();

			if(this.tcpClient != null )
			{
				messageList = SendCommand("QUIT");
				this.tcpClient.Close();
			}
		}

		public ArrayList Dir(String mask)
		{
			ArrayList tmpList = Dir();

			DataTable table = new DataTable();
			table.Columns.Add("Name");
			for(int i = 0; i < tmpList.Count; i++)
			{
				DataRow row = table.NewRow();
				row["Name"] = (string)tmpList[i];
				table.Rows.Add(row);
			}

			DataRow [] rowList = table.Select("Name LIKE '" + mask + "'", "", DataViewRowState.CurrentRows);
			tmpList = new ArrayList();
			for(int i = 0; i < rowList.Length; i++)
			{
				tmpList.Add((string)rowList[i]["Name"]);
			}

			return tmpList;
		}
		
		public ArrayList Dir()
		{
			LockTcpClient();
			TcpListener listner = null;
			TcpClient client = null;
			NetworkStream networkStream = null;
			ArrayList tempMessageList = new ArrayList();
			int returnValue = 0;
			string returnValueMessage = "";
			ArrayList fileList = new ArrayList();

			SetTransferType(FTPFileTransferType.ASCII);

			if(this.mode == FTPMode.Active)
			{
				listner = CreateDataListner();
				listner.Start();
			}
			else
			{
				client = CreateDataClient();
			}

			tempMessageList = new ArrayList();
			tempMessageList = SendCommand("NLST");
			returnValue = GetMessageReturnValue((string)tempMessageList[0]);
			if(!(returnValue == 150 || returnValue == 125 || returnValue == 550))
			{
				throw new Exception((string)tempMessageList[0]);
			}

			if(returnValue == 550) //No files found
			{
				return fileList;
			}

			if(this.mode == FTPMode.Active)
			{
				client = listner.AcceptTcpClient();
			}
			networkStream = client.GetStream();

			fileList = ReadLines(networkStream);

			if(tempMessageList.Count == 1)
			{
				tempMessageList = Read();
				returnValue = GetMessageReturnValue((string)tempMessageList[0]);
				returnValueMessage = (string)tempMessageList[0];
			}
			else
			{
				returnValue = GetMessageReturnValue((string)tempMessageList[1]);
				returnValueMessage = (string)tempMessageList[1];
			}

			if(!(returnValue == 226))
			{
				throw new Exception(returnValueMessage);
			}

			networkStream.Close();
			client.Close();

			if(this.mode == FTPMode.Active)
			{
				listner.Stop();
			}
			UnlockTcpClient();
			return fileList;
		}

		public void SendStream(Stream stream, string remoteFileName, FTPFileTransferType type)
		{
			LockTcpClient();
			TcpListener listner = null;
			TcpClient client = null;
			NetworkStream networkStream = null;
			ArrayList tempMessageList = new ArrayList();
			int returnValue = 0;
			string returnValueMessage = "";
			tempMessageList = new ArrayList();

			SetTransferType(type);

			if(this.mode == FTPMode.Active)
			{
				listner = CreateDataListner();
				listner.Start();
			}
			else
			{
				client = CreateDataClient();
			}

			tempMessageList = SendCommand("STOR " + remoteFileName);
			returnValue = GetMessageReturnValue((string)tempMessageList[0]);
			if(!(returnValue == 150 || returnValue == 125))
			{
				throw new Exception((string)tempMessageList[0]);
			}

			if(this.mode == FTPMode.Active)
			{
				client = listner.AcceptTcpClient();
			}

			networkStream = client.GetStream();

			Byte[] buffer = new Byte[BLOCK_SIZE];
			int bytes = 0;
			int totalBytes = 0;

			while(totalBytes < stream.Length)
			{
				bytes = (int)stream.Read(buffer, 0, BLOCK_SIZE);
				totalBytes = totalBytes + bytes;
				networkStream.Write(buffer, 0, bytes);
			}

			networkStream.Close();
			client.Close();

			if(this.mode == FTPMode.Active)
			{
				listner.Stop();
			}

			if(tempMessageList.Count == 1)
			{
				tempMessageList = Read();
				returnValue = GetMessageReturnValue((string)tempMessageList[0]);
				returnValueMessage = (string)tempMessageList[0];
			}
			else
			{
				returnValue = GetMessageReturnValue((string)tempMessageList[1]);
				returnValueMessage = (string)tempMessageList[1];
			}

			if(!(returnValue == 226))
			{
				throw new Exception(returnValueMessage);
			}
			UnlockTcpClient();
		}

		public virtual void SendFile(string localFileName, FTPFileTransferType type)
		{
			SendFile(localFileName, Path.GetFileName(localFileName), type);
		}

		public virtual void SendFile(string localFileName, string remoteFileName, FTPFileTransferType type)
		{
			FileStream fs = new FileStream(localFileName,FileMode.Open);
			SendStream(fs, remoteFileName, type);
			fs.Close();
		}

		public void GetStream(string remoteFileName, Stream stream, FTPFileTransferType type)
		{
			TcpListener listner = null;
			TcpClient client = null;
			NetworkStream networkStream = null;
			ArrayList tempMessageList = new ArrayList();
			int returnValue = 0;
			string returnValueMessage = "";

			LockTcpClient();

			SetTransferType(type);

			if(this.mode == FTPMode.Active)
			{
				listner = CreateDataListner();
				listner.Start();
			}
			else
			{
				client = CreateDataClient();
			}

			tempMessageList = new ArrayList();
			tempMessageList = SendCommand("RETR " + remoteFileName);
			returnValue = GetMessageReturnValue((string)tempMessageList[0]);
			if(!(returnValue == 150 || returnValue == 125))
			{
				throw new Exception((string)tempMessageList[0]);
			}

			if(this.mode == FTPMode.Active)
			{
				client = listner.AcceptTcpClient();
			}

			networkStream = client.GetStream();

			Byte[] buffer = new Byte[BLOCK_SIZE];

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
大白屁股一区二区视频| 日韩三级免费观看| 日韩欧美中文字幕公布| 中文字幕av一区二区三区高| 亚洲电影你懂得| 91小视频免费看| 久久先锋资源网| 首页国产丝袜综合| 国产精品自拍一区| 精品精品欲导航| 亚洲视频综合在线| 精品在线播放免费| 欧美视频在线不卡| 国产农村妇女精品| 美女视频网站黄色亚洲| 99国产欧美另类久久久精品| 91麻豆精品国产91久久久久久久久| 国产欧美日韩综合精品一区二区 | 国产精品 日产精品 欧美精品| 99re这里只有精品首页| 日韩视频免费观看高清在线视频| 亚洲色图在线视频| 日本成人超碰在线观看| 99久久精品国产观看| 精品精品国产高清a毛片牛牛| 亚洲乱码一区二区三区在线观看| 九一久久久久久| 欧美日韩亚洲综合一区二区三区| 国产精品美女久久久久久久久| 青娱乐精品视频| 欧美美女视频在线观看| 亚洲视频免费看| 国产成人综合视频| 91精品国产手机| 午夜电影网一区| 日本高清成人免费播放| 成人欧美一区二区三区| 丁香天五香天堂综合| 精品国产免费久久| 亚洲一区二区三区在线看| 蜜桃av一区二区| 91视频免费播放| 国产精品天美传媒| bt欧美亚洲午夜电影天堂| 日韩精品一区二区三区在线| 中文字幕中文字幕一区| 成人av在线资源| 亚洲色图在线看| 欧美性高清videossexo| 亚洲国产精品久久久久婷婷884| 色综合久久久久| 最新热久久免费视频| 波波电影院一区二区三区| 中文字幕不卡的av| 91尤物视频在线观看| 亚洲美女免费在线| 91久久精品网| 亚洲成人av一区| 欧美一区二区三区四区高清| 日本特黄久久久高潮| 日韩写真欧美这视频| 久久成人18免费观看| 久久精品视频一区二区三区| 国产久卡久卡久卡久卡视频精品| 精品剧情v国产在线观看在线| 国产美女在线精品| 精品国产露脸精彩对白| 成人91在线观看| 亚洲成人av福利| 精品国产免费视频| 波多野结衣视频一区| 亚洲国产aⅴ天堂久久| 在线播放一区二区三区| 精品亚洲免费视频| 亚洲欧洲精品成人久久奇米网| 欧美伊人久久久久久久久影院 | 91在线国产观看| 亚洲制服丝袜一区| 欧美亚洲自拍偷拍| 韩日av一区二区| 亚洲欧美激情视频在线观看一区二区三区 | 精品国产91九色蝌蚪| 成人午夜视频免费看| 国产精品理伦片| 欧美日韩高清在线播放| 国产精品一区二区免费不卡 | 亚洲电影一级黄| 亚洲精品一区二区三区香蕉| 成人aa视频在线观看| 日韩中文字幕91| 国产精品美女一区二区三区 | 欧美一区二区美女| 国产.欧美.日韩| 偷拍与自拍一区| 国产精品福利在线播放| 91精品国产色综合久久不卡电影 | 亚洲色图20p| 欧美变态口味重另类| 色婷婷亚洲精品| 丰满白嫩尤物一区二区| 午夜日韩在线电影| 成人欧美一区二区三区白人| 精品理论电影在线| 欧美性大战久久| caoporn国产精品| 国产一区在线观看视频| 日韩不卡在线观看日韩不卡视频| 国产精品欧美极品| 久久精品亚洲精品国产欧美| 91精品免费在线观看| 91理论电影在线观看| 成人在线视频一区二区| 国产自产高清不卡| 日韩av一二三| 一区二区免费视频| 亚洲丝袜自拍清纯另类| 国产日产欧产精品推荐色| 精品久久久三级丝袜| 91精品国产综合久久久久久久 | 欧美96一区二区免费视频| 亚洲高清免费观看 | 国产精品系列在线播放| 精品一区二区三区在线视频| 日本亚洲免费观看| 日韩中文字幕91| 麻豆国产精品官网| 麻豆国产一区二区| 激情久久五月天| 国产在线播放一区二区三区| 精品一二三四区| 国产一区二区不卡在线 | 亚洲福利视频一区二区| 亚洲激情自拍偷拍| 亚洲影院久久精品| 亚洲国产成人va在线观看天堂| 亚洲一级二级三级| 日韩av电影免费观看高清完整版在线观看| 有坂深雪av一区二区精品| 亚洲资源在线观看| 午夜精彩视频在线观看不卡| 婷婷一区二区三区| 奇米色一区二区| 精品亚洲成a人在线观看| 国产一区二区三区精品欧美日韩一区二区三区 | 亚洲国产日韩一级| 日韩黄色免费电影| 国产一区二区三区蝌蚪| 国产91在线|亚洲| 97aⅴ精品视频一二三区| 欧日韩精品视频| 欧美精品日韩一区| 2023国产精华国产精品| 国产欧美日韩三区| 亚洲美女在线国产| 日韩影视精彩在线| 激情文学综合插| 91丨九色丨黑人外教| 欧美三级午夜理伦三级中视频| 91精品国产综合久久精品app | 久久免费精品国产久精品久久久久| 久久久久久黄色| 亚洲伦理在线精品| 蜜桃av一区二区三区| 不卡的看片网站| 欧美日韩一区二区在线观看| 久久亚洲一区二区三区明星换脸 | 亚洲免费观看视频| 蜜臀91精品一区二区三区| 国产成人精品网址| 欧美探花视频资源| 国产欧美日韩另类一区| 亚洲线精品一区二区三区 | 69堂成人精品免费视频| 久久久久久久久久看片| 樱花影视一区二区| 国产综合色视频| 欧美日韩国产三级| 国产精品久久影院| 蜜臀精品久久久久久蜜臀| 成人免费视频免费观看| 欧美一区二区视频在线观看| 国产精品久久久久久久午夜片| 日韩精品亚洲专区| 色综合久久中文字幕综合网 | 欧美三级视频在线观看| 亚洲国产高清不卡| 久久精品国内一区二区三区| 色哟哟在线观看一区二区三区| 欧美r级电影在线观看| 亚洲综合在线视频| 成人精品视频一区二区三区| 日韩欧美三级在线| 亚洲一区二区中文在线| 99久久婷婷国产综合精品| 精品国产精品网麻豆系列| 性感美女久久精品| 色婷婷亚洲一区二区三区| 一区在线观看视频| 国产99久久久国产精品| 久久午夜色播影院免费高清 |