C#编写的FTP上传简单工具类
///param name=remotePort/parampublic FTPClient(string remoteHost, string remotePath, string remoteUser, string remotePass,int remotePort)strRemoteHost=remoteHost;s trRemoteP ath=remoteP ath;strRemoteUs er=remoteUs er;strRemotePas s=remotePas s;strRemotePort=remotePort;
Connect();
#endregion
//FTPClient fc=new FTPClient( 172.22.1.15, /bcgz/x25/awstod,zxt, 123456,21);
// //fc.ChDir( /bcgz/x25/awstod
// //Console.WriteLine(fc.RemotePath);
//fc.Get(S 5290900.A1053 ,@F:\ttt,
// //fc.getawsFile(S5290400.A1053
#region登陆
///s ummary
///FTP服务器IP地址
////s ummaryprivate string strRemoteHost;public string RemoteHostreturn strRemoteHost;
strRemoteHost=value;
///s ummary
///FTP服务器端口
////s ummaryprivate int strRemotePort;public int RemotePortreturn strRemotePort;strRemotePort=value;
///s ummary
///当前服务器目录
////s ummaryprivate string strRemotePath;public string RemotePathreturn s trRemotePath;s trRemoteP ath=value;
///s ummary
///登录用户账号
////s ummaryprivate string strRemoteUser;public string RemoteUs ers trRemoteUs er=value;
///s ummary
///用户登录密码
////s ummaryprivate string strRemotePas s;public string RemotePassstrRemotePas s=value;
///s ummary
///是否登录
////s ummaryprivate Boolean bConnected;public bool Connectedreturn bConnected;
#endregion
#region链接
///s ummary
///建立连接
////s ummarypublic void Connect()socketControl = new Socket(AddressFamily.InterNetwork, SocketType.Stream,Protoc olType.Tcp);
IPEndPoint ep=new IPEndPoint(IPAddress.Parse(RemoteHost), strRemotePort);
//链接s ocketControl.Connect(ep);
c atch(Exc eption)throw new IOException(Couldnt connect to remote server//获取应答码
Re adRep ly();if(iReply Code !=220)
Dis Connect();throw new IOExc eption(strReply.Substring(4));
//登陆
S endCommand(US ER+s trRemoteUs er);if(!(iRep lyCode==331 | | iReplyCod e==230))
CloseSocketConnect();//关闭连接throw new IOExc eption(strReply.Substring(4));if(iReply Code !=230)
SendCommand(PAS S+strRemotePas s);if(!(iRep lyCode==230| | iReplyCod e==202))
CloseSocketConnect();//关闭连接throw new IOExc eption(strReply.Substring(4));bConnec ted=true;
//切换到目录
ChD ir(s trRemoteP ath);
///param name=ttType传输模式/parampublic void SetTransferType(TransferType ttType)
if(ttTyp e==T ransferTyp e.Binary)
SendCommand(TYPE I //binary类型传输els e
SendCommand(TYPE A//ASCII类型传输if(iReply Code !=200)throw new IOExc eption(strReply.Substring(4));els etr Typ e=ttTyp e;
百纵科技官网:https://www.baizon.cn/百纵科技:美国云服务器活动重磅来袭,洛杉矶C3机房 带金盾高防,会员后台可自助管理防火墙,添加黑白名单 CC策略开启低中高.CPU全系列E52680v3 DDR4内存 三星固态盘列阵。另有高防清洗!美国洛杉矶 CN2 云服务器CPU内存带宽数据盘防御价格1H1G10M10G10G19元/月 购买地址2H1G10M10G10G29元/月 购买...
Sharktech 鲨鱼机房商家我们是不是算比较熟悉的,因为有很多的服务商渠道的高防服务器都是拿他们家的机器然后部署高防VPS主机的,不过这几年Sharktech商家有自己直接销售云服务器产品,比如看到有新增公有云主机有促销活动,一般有人可能买回去自己搭建虚拟主机拆分销售的,有的也是自用的。有看到不少网友在分享到鲨鱼机房商家促销活动期间,有赠送开通公有云主机$50,可以购买最低配置的,$49/月的...
国外商家提供Windows系统的并不常见,CheapWindowsVPS 此次提供的 2 款 VPS 促销套餐,提供 5 折永久优惠码,优惠后月付 4.5 美元起,价格还是挺诱人的,VPS 不限流量,接入 1Gbps 带宽,8 个机房皆可选,其中洛杉矶机房还提供亚洲优化网络供选择,操作系统有 Windows 10 专业版、2012 R2、2016、Linux等。Cheap Windows VPS是...