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

wordpress高级跨屏企业主题 wordpress绿色企业自适应主题

wordpress高级跨屏企业主题,通用响应式跨平台站点开发,自适应PC端+各移动端屏幕设备,高级可视化自定义设置模块+高效的企业站搜索优化。wordpress绿色企业自适应主题采用标准的HTML5+CSS3语言开发,兼容当下的各种主流浏览器: IE 6+(以及类似360、遨游等基于IE内核的)、Firefox、Google Chrome、Safari、Opera等;同时支持移动终端的常用浏览器应...

cera:秋季美国便宜VPS促销,低至24/月起,多款VPS配置,自带免费Windows

介绍:819云怎么样?819云创办于2019,由一家从2017年开始从业的idc行业商家创办,主要从事云服务器,和物理机器819云—-带来了9月最新的秋季便宜vps促销活动,一共4款便宜vps,从2~32G内存,支持Windows系统,…高速建站的美国vps位于洛杉矶cera机房,服务器接入1Gbps带宽,采用魔方管理系统,适合新手玩耍!官方网站:https://www.8...

HostKvm5.95美元起,香港、韩国可选

HostKvm发布了夏季特别促销活动,针对香港国际/韩国机房VPS主机提供7折优惠码,其他机房全场8折,优惠后2GB内存套餐月付仅5.95美元起。这是一家成立于2013年的国外主机服务商,主要提供基于KVM架构的VPS主机,可选数据中心包括日本、新加坡、韩国、美国、中国香港等多个地区机房,均为国内直连或优化线路,延迟较低,适合建站或者远程办公等。下面分享几款香港VPS和韩国VPS的配置和价格信息。...

上传工具为你推荐
万维读者网用QQ邮箱向《读者》投稿具体格式办公协同软件协同企业办公的软件有哪些?彩信中心联通手机的彩信中心如何设置?godaddyGO DADDY服务器空间域名怎么样神雕侠侣礼包大全神雕侠侣先手礼包在哪领创维云电视功能创维云电视是指什么二层交换机二层交换机是什么意思,三层呢电子商务网站模板电子商务网站模板有免费的吗?电子商务网站模板哪里有?电子商务网站模板怎么找?网站优化方案网站优化方案怎么写?怎么上传音乐怎么上传音乐
查询域名 上海vps idc评测 host1plus 香港机房 Dedicated 128m内存 cloudstack ubuntu更新源 镇江联通宽带 三拼域名 上海域名 柚子舍官网 合租空间 qq云端 傲盾官网 免费phpmysql空间 免费cdn 微软服务器操作系统 上海服务器 更多