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;
hostwebis怎么样?hostwebis昨天在webhosting发布了几款美国高配置大硬盘机器,但报价需要联系客服。看了下该商家的其它产品,发现几款美国服务器、法国服务器还比较实惠,100Mbps不限流量,高配置大硬盘,$44/月起,有兴趣的可以关注一下。HostWebis是一家国外主机品牌,官网宣称1998年就成立了,根据目标市场的不同,以不同品牌名称提供网络托管服务。2003年,通过与W...
DogYun(中文名称狗云)新上了一批韩国自动化上架独立服务器,使用月减200元优惠码后仅需每月300元,双E5 CPU,SSD+NVMe高性能硬盘,支持安装Linux或者Windows操作系统,下单自动化上架。这是一家成立于2019年的国人主机商,提供VPS和独立服务器租用等产品,数据中心包括中国香港、美国洛杉矶、日本、韩国、德国、荷兰等。下面分享这款自动化上架韩国独立服务器的配置和优惠码信息。...
ShockHosting商家在前面文章中有介绍过几次。ShockHosting商家成立于2013年的美国主机商,目前主要提供虚拟主机、VPS主机、独立服务器和域名注册等综合IDC业务,现有美国洛杉矶、新泽西、芝加哥、达拉斯、荷兰阿姆斯特丹、英国和澳大利亚悉尼七大数据中心。这次有新增日本东京机房。而且同时有推出5折优惠促销,而且即刻使用支付宝下单的话还可获赠10美金的账户信用额度,折扣相比之前的常规...