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

ReliableSite怎么样,月付$95美国洛杉矶独立服务器

ReliableSite怎么样?ReliableSite好不好。ReliableSite是一家成立于2006年的老牌美国商家,主要经营美国独立服务器租赁,数据中心位于:洛杉矶、迈阿密、纽约,带宽1Gbps起步,花19美元/月即可升级到10Gbps带宽,月流量150T足够各种业务场景使用,且免费提供20Gbps DDoS防护。当前商家有几款大硬盘美国独服,地点位于美国洛杉矶或纽约机房,机器配置很具有...

BGPTO独服折优惠- 日本独服65折 新加坡独服75折

BGPTO是一家成立于2017年的国人主机商,从商家背景上是国内的K总和有其他投资者共同创办的商家,主营是独立服务器业务。数据中心包括美国洛杉矶Cera、新加坡、日本大阪和香港数据中心的服务器。商家对所销售服务器产品拥有自主硬件和IP资源,支持Linux和Windows。这个月,有看到商家BGPTO日本和新加坡机房独服正进行优惠促销,折扣最低65折。第一、商家机房优惠券码这次商家的活动机房是新加坡...

IonSwitch:$1.75/月KVM-1GB/10G SSD/1TB/爱达荷州

IonSwitch是一家2016年成立的国外VPS主机商,部落上一次分享的信息还停留在2019年,主机商提供基于KVM架构的VPS产品,数据中心之前在美国西雅图,目前是美国爱达荷州科德阿伦(美国西北部,西接华盛顿州和俄勒冈州),为新建的自营数据中心。商家针对新数据中心运行及4号独立日提供了一个5折优惠码,优惠后最低1GB内存套餐每月仅1.75美元起。下面列出部分套餐配置信息。CPU:1core内存...

上传工具为你推荐
photoimpact教程PhotoImpact 7 中文版印章制作用美图秀秀怎么做印章效果啊?google地球打不开手机谷歌地球怎么打不开?iphone5解锁iphone5怎么解锁微信如何建群微信建群怎么建pwlosera,pw是什么,是不认识的人发的短信。请解释::显卡温度多少正常显卡温度是多少才算正常的?数码资源网安卓有没有可以离线刷题的软件?ios7固件下载iOS的固件有正版盗版之分吗?我看到了蜂威网有iOS7的固件想下载试用一下,那里是测试版是正版吗宽带接入服务器什么是宽带接入系统?怎样绕过宽带接入系统上网
php空间租用 bluehost 网通代理服务器 蜗牛魔方 有益网络 东莞服务器 shopex主机 smtp虚拟服务器 备案空间 空间服务器 卡巴斯基官网下载 石家庄服务器 学生机 nic wannacry勒索病毒 香港打折信息 德国代理 饭桶 流媒体服务器软件 国外bt下载网站 更多