传输c 编写的ftp上传简单工具类

上传工具  时间:2021-02-23  阅读:()

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;

95IDC香港特价物理机服务器月付299元起,5个ip/BGP+CN2线路;美国CERA服务器仅499元/月起

95idc是一家香港公司,主要产品香港GIA线路沙田CN2线路独服,美国CERA高防服务器,日本CN2直连服务器,即日起,购买香港/日本云主机,在今年3月份,95IDC推出来一款香港物理机/香港多ip站群服务器,BGP+CN2线路终身7折,月付350元起。不过今天,推荐一个价格更美的香港物理机,5个ip,BGP+CN2线路,月付299元起,有需要的,可以关注一下。95idc优惠码:优惠码:596J...

BlueHost主机商年中618活动全场低至五折

BlueHost 主机商在以前做外贸网站的时候还是经常会用到的,想必那时候有做外贸网站或者是选择海外主机的时候还是较多会用BlueHost主机商的。只不过这些年云服务器流行且性价比较高,于是大家可选择商家变多,但是BlueHost在外贸主机用户群中可选的还是比较多的。这次年中618活动大促来袭,毕竟BLUEHOST商家目前中文公司设立在上海,等后面有机会也过去看看。他们也会根据我们的国内年中促销发...

远程登录VNC无法连接出现

今天有网友提到自己在Linux服务器中安装VNC桌面的时候安装都没有问题,但是在登录远程的时候居然有出现灰色界面,有三行代码提示"Accept clipboard from viewers,Send clipboard to viewers,Send primary selection to viewers"。即便我们重新登录也不行,这个到底如何解决呢?这里找几个可以解决的可能办法,我们多多尝试。...

上传工具为你推荐
免费制作qq空间如何免费制作QQ空间博客外链博客外链怎么做好雅虎社区雅虎资讯在哪里提交xp系统停止服务Windowsxp系统为什么停止服务淘宝网页显示不正常淘宝网页不能正常显示qq空间打扮QQ空间打扮人人逛街人人逛街评论怎么不显示链接了?好像4月28日就不能显示了。是什么原因呢?安装迅雷看看播放器迅雷看看播放器下了安装不了虚拟专用网虚拟专用网 有什么用处?srv记录SRV记录的简介
什么是虚拟主机 服务器租用托管 国际域名抢注 godaddy主机 bluehost mach5 服务器怎么绑定域名 500m空间 卡巴斯基永久免费版 100x100头像 ftp教程 谁的qq空间最好看 工信部icp备案号 asp免费空间申请 北京双线 免费全能主机 流媒体加速 web服务器搭建 申请网站 防cc攻击 更多