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;
Virmach 商家算是比较久且一直在低价便宜VPS方案中玩的不亦乐乎的商家,有很多同时期的商家纷纷关闭转让,也有的转型到中高端用户。而前一段时间也有分享过一次Virmach商家推出所谓的一次性便宜VPS主机,比如很低的价格半年时间,时间到服务器也就关闭。这不今天又看到商家有提供这样的产品。这次的活动产品包括圣何塞和水牛城两个机房,为期六个月,一次性付费用完将会取消,就这么特别的产品,适合短期玩玩...
商家介绍:创梦云是来自国内的主机销售商,成立于2018年4月30日,创梦云前期主要从事免备案虚拟主机产品销售,现在将提供5元挂机宝、特惠挂机宝、香港云服务器、美国云服务器、低价挂机宝等产品销售。主打高性价比高稳定性挂机宝、香港云服务器、美国云服务器、香港虚拟主机、美国虚拟主机。官方网站:http://cmy0.vnetdns.com本次促销产品:地区CPU内存硬盘带宽价格购买地址香港特价云服务器1...
官方网站:点击访问青云互联活动官网优惠码:终身88折扣优惠码:WN789-2021香港测试IP:154.196.254美国测试IP:243.164.1活动方案:用户购买任意全区域云服务器月付以上享受免费更换IP服务;限美国区域云服务器凡是购买均可以提交工单定制天机防火墙高防御保护端口以及保护模式;香港区域购买季度、半年付、年付周期均可免费申请额外1IP;使用优惠码购买后续费周期终身同活动价,价格不...