资源简介
网上东拼西凑的FTP代码,修改了下,改成能用的,也能下载指定目录的子目录。。。

代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.IO;
using System.Net.Sockets;
namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender EventArgs e)
{
FTPClient ftp = new FTPClient(“192.168.1.2“ ““ “administrator“ “1234“ 21);
ftp.MkLocalDir(“c://ftp//ftp“);//如果本地无此目录,则先创建本地空目录
ftp.Get(“远程目录“ “c://ftp//ftp“);
}
}
///
/// FTPClient 的摘要说明。
///
public class FTPClient
{
#region 构造函数
///
/// 缺省构造函数
///
public FTPClient()
{
strRemoteHost = ““;
strRemotePath = ““;
strRemoteUser = ““;
strRemotePass = ““;
strRemotePort = 21;
bConnected = false;
} ///
/// 构造函数
///
///
///
///
///
///
public FTPClient(string remoteHost string remotePath string remoteUser string remotePass int remotePort)
{
strRemoteHost = remoteHost;
strRemotePath = remotePath;
strRemoteUser = remoteUser;
strRemotePass = remotePass;
strRemotePort = remotePort;
Connect();
}
#endregion
#region 登陆
///
/// FTP服务器IP地址
///
private string strRemoteHost;
public string RemoteHost
{
get
{
return strRemoteHost;
}
set
{
strRemoteHost = value;
}
}
///
/// FTP服务器端口
///
private int strRemotePort;
public int RemotePort
{
get
{
return strRemotePort;
}
set
{
strRemotePort = value;
}
}
///
/// 当前服务器目录
///
private string strRemotePath;
public string RemotePath
{
get
{
return strRemotePath;
}
set
{
strRemotePath = value;
}
}
///
/// 登录用户账号
///
private string strRemoteUser;
public string Re
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 0 2010-07-28 13:15 WindowsFormsApplication2\WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\App_Code.compiled
文件 0 2010-07-28 13:15 WindowsFormsApplication2\WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\App_Code.dll
文件 0 2010-07-28 13:15 WindowsFormsApplication2\WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\App_WebReferences.compiled
文件 0 2010-07-28 13:15 WindowsFormsApplication2\WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\App_WebReferences.dll
文件 0 2010-07-28 13:16 WindowsFormsApplication2\WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\App_Web_-efesya9.dll
文件 0 2010-07-28 13:15 WindowsFormsApplication2\WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\App_Web_05i78sau.dll
文件 0 2010-07-28 13:16 WindowsFormsApplication2\WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\App_Web_146dcl0i.dll
文件 0 2010-07-28 13:16 WindowsFormsApplication2\WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\App_Web_1h8grwi7.dll
文件 0 2010-07-28 13:16 WindowsFormsApplication2\WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\App_Web_1_jsicn8.dll
文件 0 2010-07-28 13:15 WindowsFormsApplication2\WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\App_Web_5lyulqir.dll
文件 0 2010-07-28 13:16 WindowsFormsApplication2\WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\App_Web_6-z8txzi.dll
文件 0 2010-07-28 13:16 WindowsFormsApplication2\WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\App_Web_9_rq534k.dll
文件 0 2010-07-28 13:16 WindowsFormsApplication2\WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\App_Web_aqd2-5nb.dll
文件 0 2010-07-28 13:16 WindowsFormsApplication2\WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\App_Web_cz14p-en.dll
文件 0 2010-07-28 13:16 WindowsFormsApplication2\WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\App_Web_dcrosypc.dll
文件 0 2010-07-28 13:15 WindowsFormsApplication2\WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\App_Web_fgqqtjrw.dll
文件 0 2010-07-28 13:16 WindowsFormsApplication2\WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\App_Web_ihu0ggk2.dll
文件 0 2010-07-28 13:16 WindowsFormsApplication2\WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\App_Web_ipmpocb3.dll
文件 0 2010-07-28 13:16 WindowsFormsApplication2\WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\App_Web_jpkihzoh.dll
文件 0 2010-07-28 13:16 WindowsFormsApplication2\WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\App_Web_jyuruo0k.dll
文件 0 2010-07-28 13:15 WindowsFormsApplication2\WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\App_Web_k3ybwjkl.dll
文件 0 2010-07-28 13:16 WindowsFormsApplication2\WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\App_Web_kfl6ljo7.dll
文件 0 2010-07-28 13:16 WindowsFormsApplication2\WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\App_Web_kiycmzxp.dll
文件 0 2010-07-28 13:16 WindowsFormsApplication2\WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\App_Web_o16tk79f.dll
文件 0 2010-07-28 13:16 WindowsFormsApplication2\WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\App_Web_rkpqmfbz.dll
文件 0 2010-07-28 13:15 WindowsFormsApplication2\WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\App_Web_sltgwqmv.dll
文件 0 2010-07-28 13:16 WindowsFormsApplication2\WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\App_Web_so8x8bwx.dll
文件 0 2010-07-28 13:16 WindowsFormsApplication2\WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\App_Web_sregt88r.dll
文件 0 2010-07-28 13:16 WindowsFormsApplication2\WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\App_Web_t8eka0xj.dll
文件 0 2010-07-28 13:16 WindowsFormsApplication2\WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\App_Web_ve2wbclz.dll
............此处省略59个文件信息
相关资源
- C# TIP文件生成和拆解
- C#解析HL7消息的库135797
- C# OCR数字识别实例,采用TessnetOcr,对
- 考试管理系统 - C#源码
- asp.net C#购物车源代码
- C#实时网络流量监听源码
- C#百度地图源码
- Visual C#.2010从入门到精通配套源程序
- C# 软件版本更新
- C#屏幕软键盘源码,可以自己定制界面
- 智慧城市 智能家居 C# 源代码
- c#获取mobile手机的IMEI和IMSI
- C#实现简单QQ聊天程序
- 操作系统 模拟的 欢迎下载 C#版
- C#写的计算机性能监控程序
- 用C#实现邮件发送,有点类似于outlo
- MVC model层代码生成器 C#
- c#小型图书销售系统
- C# Socket Server Client 通讯应用 完整的服
- c# winform 自动登录 百度账户 源代码
- C#编写的16进制计算器
- C#TCP通信协议
- C# 数据表(Dataset)操作 合并 查询一
- C#语音识别系统speechsdk51,SpeechSDK51L
- 数据库备份还原工具1.0 C# 源码
-
[免费]xm
lDocument 节点遍历C# - EQ2008LEDc#开发实例
- DirectX.Capturec# winform 操作摄像头录像附
- c# 实现的最大最小距离方法对鸢尾花
- C#版保龄球记分代码
评论
共有 条评论