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;
ReliableSite怎么样?ReliableSite好不好。ReliableSite是一家成立于2006年的老牌美国商家,主要经营美国独立服务器租赁,数据中心位于:洛杉矶、迈阿密、纽约,带宽1Gbps起步,花19美元/月即可升级到10Gbps带宽,月流量150T足够各种业务场景使用,且免费提供20Gbps DDoS防护。当前商家有几款大硬盘美国独服,地点位于美国洛杉矶或纽约机房,机器配置很具有...
BGPTO是一家成立于2017年的国人主机商,从商家背景上是国内的K总和有其他投资者共同创办的商家,主营是独立服务器业务。数据中心包括美国洛杉矶Cera、新加坡、日本大阪和香港数据中心的服务器。商家对所销售服务器产品拥有自主硬件和IP资源,支持Linux和Windows。这个月,有看到商家BGPTO日本和新加坡机房独服正进行优惠促销,折扣最低65折。第一、商家机房优惠券码这次商家的活动机房是新加坡...
IonSwitch是一家2016年成立的国外VPS主机商,部落上一次分享的信息还停留在2019年,主机商提供基于KVM架构的VPS产品,数据中心之前在美国西雅图,目前是美国爱达荷州科德阿伦(美国西北部,西接华盛顿州和俄勒冈州),为新建的自营数据中心。商家针对新数据中心运行及4号独立日提供了一个5折优惠码,优惠后最低1GB内存套餐每月仅1.75美元起。下面列出部分套餐配置信息。CPU:1core内存...