传输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;

legionbox:美国、德国和瑞士独立服务器,E5/16GB/1Gbps月流量10TB起/$69/月起

legionbox怎么样?legionbox是一家来自于澳大利亚的主机销售商,成立时间在2014年,属于比较老牌商家。主要提供VPS和独立服务器产品,数据中心包括美国洛杉矶、瑞士、德国和俄罗斯。其中VPS采用KVM和Xen架构虚拟技术,硬盘分机械硬盘和固态硬盘,系统支持Windows。当前商家有几款大硬盘的独立服务器,可选美国、德国和瑞士机房,有兴趣的可以看一下,付款方式有PAYPAL、BTC等。...

百纵科技,美国独立服务器 E52670*1 32G 50M 200G防御 899元/月

百纵科技:美国高防服务器,洛杉矶C3机房 独家接入zenlayer清洗 带金盾硬防,CPU全系列E52670、E52680v3 DDR4内存 三星固态盘阵列!带宽接入了cn2/bgp线路,速度快,无需备案,非常适合国内外用户群体的外贸、搭建网站等用途。C3机房,双程CN2线路,默认200G高防,3+1(高防IP),不限流量,季付送带宽美国洛杉矶C3机房套餐处理器内存硬盘IP数带宽线路防御价格/月套...

随风云25元/月 ,德阳高防云服务器 2核2G 10M 75元/月 内蒙古三线BGP服务器 2核2G 5M

公司介绍成都随风云科技有限公司成立于2021年,是国内领先的互联网业务平台服务提供商。公司专注为用户提供低价高性能云计算产品,致力于云计算应用的易用性开发,并引导云计算在国内普及。目前公司研发以及运营云服务基础设施服务平台(IaaS),面向全球客户提供基于云计算的IT解决方案与客户服务,拥有丰富的国内BGP、双线高防、香港等优质的IDC资源。公司一直秉承”以人为本、客户为尊、永续创新&...

上传工具为你推荐
手机游戏排行榜20152017年的手游排行榜?windows优化大师怎么用如何用Windows优化大师??如何免费开通黄钻怎么免费开通黄钻~~~?spgnux思普操作系统怎么样申请证书手机申请证书网店推广网站怎么免费推广淘宝店铺?神雕侠侣礼包大全神雕侠侣手游华山论剑礼包有什么 怎么领取畅想中国畅想中国发展前景雅虎天盾雅虎天盾、瑞星杀毒软件、瑞星防火墙、卡卡上网安全助手能同时使用吗?bt封杀BT下载被封锁了,怎么办,下载不了电影了!
域名抢注 tk域名注册 高防服务器租用 拜登买域名批特朗普 vir vultr美国与日本 免备案空间 42u机柜尺寸 免费cdn加速 阿里云浏览器 php空间推荐 91vps 宏讯 电信网络测速器 湖南idc 服务器防火墙 后门 创速 带宽测试 广州服务器托管 更多