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

ftp工具  时间:2021-03-20  阅读:()

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:美国/法国便宜服务器,100Mbps不限流量,高配置大硬盘,$44/月起

hostwebis怎么样?hostwebis昨天在webhosting发布了几款美国高配置大硬盘机器,但报价需要联系客服。看了下该商家的其它产品,发现几款美国服务器、法国服务器还比较实惠,100Mbps不限流量,高配置大硬盘,$44/月起,有兴趣的可以关注一下。HostWebis是一家国外主机品牌,官网宣称1998年就成立了,根据目标市场的不同,以不同品牌名称提供网络托管服务。2003年,通过与W...

DogYun(300元/月),韩国独立服务器,E5/SSD+NVMe

DogYun(中文名称狗云)新上了一批韩国自动化上架独立服务器,使用月减200元优惠码后仅需每月300元,双E5 CPU,SSD+NVMe高性能硬盘,支持安装Linux或者Windows操作系统,下单自动化上架。这是一家成立于2019年的国人主机商,提供VPS和独立服务器租用等产品,数据中心包括中国香港、美国洛杉矶、日本、韩国、德国、荷兰等。下面分享这款自动化上架韩国独立服务器的配置和优惠码信息。...

ShockHosting($4.99/月),东京机房 可享受五折优惠,下单赠送10美金

ShockHosting商家在前面文章中有介绍过几次。ShockHosting商家成立于2013年的美国主机商,目前主要提供虚拟主机、VPS主机、独立服务器和域名注册等综合IDC业务,现有美国洛杉矶、新泽西、芝加哥、达拉斯、荷兰阿姆斯特丹、英国和澳大利亚悉尼七大数据中心。这次有新增日本东京机房。而且同时有推出5折优惠促销,而且即刻使用支付宝下单的话还可获赠10美金的账户信用额度,折扣相比之前的常规...

ftp工具为你推荐
checkmy音视频iphone支付宝蜻蜓发布刷脸支付加盟,支付宝蜻蜓刷脸设备出后,微信也出了青蛙刷脸设备,感觉很有前景,大伙觉得呢?中国企业在线一般都在哪里找企业信息啊?网站ipad加多宝和王老吉王老吉和加多宝谁好喝点?三友网有了解唐山三友集团的吗?大学生待遇如何,工资收入,福利保障,工作环境等等2828商机网28商机网适合年轻人做的项目??网站方案设计网站文案策划怎么写oa办公软件价格一个oa系统多少钱
域名服务器上存放着internet主机的 singlehop westhost 2014年感恩节 paypal注册教程 卡巴斯基免费试用版 免费asp空间 数据库空间 石家庄服务器托管 阿里云邮箱个人版 asp空间 石家庄服务器 第八届中美互联网论坛 restart winserver2008r2 删除域名 easypanel 内存 qq部落18-3 海康流媒体服务器 更多