资源简介
网上东拼西凑的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# 调用win32 api函数-user32.dll详细说明
- C# 调用BarTender打印条码DEMO
- 大型比赛竞赛抽签系统 可打印 c# vs
- C#编写的Gerber查看器
- lua C# .Net4.0 vs2010 LuaInterface
- C#十六进制编辑器
- 明华URF-35H读卡器 C#读写源码 为大家
- C#文件流读取CSV文件
- c#读写PDF文件sql
- C# winform Socket大文件传输
- c#车牌识别系统附30张测试图片
- 《C#面向对象程序设计》源代码(CS)
- 金旭亮《C#面向对象程序设计》教案
- 试题库管理系统毕业论文(C#)源程序
- 学校网站原代码(C#.NET)
- C#-数据库操作技术-员工管理系统
- c#web开发入门经典
- C#与Matlab混合编程的几种方式
- c# 开发与 mysql数据库实现的增删改查
- C#异步操作 异步查询数据库 异步处理
- Basler相机通过IO触发源码
- [源代码] 《领域驱动设计 (C# 2008 实
- 松下PLC与C#通讯串口调试入门教程.z
- USB 继电器控制器 LCUS-1 保证能用 c#
- C# AES加密解密小工具
- C#圆形按钮,非常漂亮动态~~
- [精]C#仿QQ右下角弹出提示框()
- C#进程间通信-共享内存代码
- 有史以来最简单的三层(C#)
- vb调用c#编写的串口DLL文件(vb源码
评论
共有 条评论