资源简介
关于ftp的实现代码,包括客户端和服务器端
代码片段和文件信息
/*/////////////////////////////////////////////////////////////////////
FTPclient.cpp (c) GDI 1999
V1.0.0 (10/4/99)
Phil Anderson. philip@gd-ind.com
Simple FTP client functionality. If you have any problems with it
please tell me about them (or better still e-mail me the fixed
code). Please feel free to use this code however you wish although
if you make changes please put your name in the source & comment what
you did.
Nothing awesome going on here at all (all sockets are used in
synchronous blocking mode) but it does the following
things WinInet doesn‘t seem to:
* Supports loads of different firewalls (I think I don‘t
have access to all types so they haven‘t all been fully
tested yet)
* Allows you to execute any command on the FTP server
* Adds 10K to your app install rather than 1Mb #;-)
Functions return TRUE if everything went OK FALSE if there was an
error. A message describing the outcome (normally the one returned
from the server) will be in m_retmsg on return from the function.
There are a few error msgs in the app‘s string table that you‘ll
need to paste into your app along with this file & FTPclient.h
If you created your app without checking the “Use Windows Sockets“
checkbox in AppWizard you‘ll need to add the following bit of code
to you app‘s InitInstance()
if(!AfxSocketInit())
{
AfxMessageBox(“Could not initialize Windows Sockets!“);
return FALSE;
}
To use:
1/ Create an object of CFTPclient.
2/ Use LogOnToServer() to connect to the server. Any arguments
not used (e.g. if you‘re not using a firewall) pass an empty
string or zero for numeric args. You must pass a server port
number use the FTP default of 21 if you don‘t know what it is.
3/ Use MoveFile() to upload/download a file 1st arg is local file
path 2nd arg is remote file path 3rd arg is TRUE for a PASV
connection (required by some firewalls) FALSE otherwise 4th arg
is TRUE to upload FALSE to download file. MoveFile only works in
synchronous mode (ie the function will not return ‘till the transfer
is finished). File transfers are always of type BINARY.
4/ You can use FTPcommand() to execute FTP commands (eg
FTPcommand(“CWD /home/mydir“) to change directory on the server)
note that this function will return FALSE unless the server response
is a 200 series code. This should work fine for most FTP commands
otherwise you can use WriteStr() and ReadStr() to send commands &
interpret the response yourself. Use LogOffServer() to disconnect
when done.
/////////////////////////////////////////////////////////////////////*/
#include “stdafx.h“
#include “FTPSOCKET.h“
#include “FTPClass.h“
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
//构造函数,变量初始化
CFTPclie
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 13630 2002-09-26 14:15 FTPClient\FTPClass.cpp
文件 1279 2002-08-07 00:48 FTPClient\FTPClass.h
文件 22568 2005-08-10 11:17 FTPClient\FTPSOCKET.APS
文件 1898 2005-08-10 12:23 FTPClient\FTPSOCKET.clw
文件 2199 2002-08-06 13:24 FTPClient\FTPSOCKET.cpp
文件 4469 2002-08-07 00:59 FTPClient\FTPSOCKET.dsp
文件 543 2002-08-06 13:24 FTPClient\FTPSOCKET.dsw
文件 1357 2002-08-06 13:24 FTPClient\FTPSOCKET.h
文件 115712 2005-08-10 12:23 FTPClient\FTPSOCKET.ncb
文件 66048 2005-08-10 12:23 FTPClient\FTPSOCKET.opt
文件 2779 2005-08-10 11:17 FTPClient\FTPSOCKET.plg
文件 6991 2002-08-08 20:58 FTPClient\FTPSOCKET.rc
文件 18185 2002-08-18 23:26 FTPClient\FTPSOCKETDlg.cpp
文件 3565 2002-08-08 21:23 FTPClient\FTPSOCKETDlg.h
文件 1614 2002-08-07 18:02 FTPClient\ListItem.cpp
文件 691 2002-03-19 16:53 FTPClient\ListItem.h
文件 3633 2002-08-06 13:24 FTPClient\ReadMe.txt
文件 1462 2002-08-08 20:58 FTPClient\Resource.h
文件 211 2002-08-06 13:24 FTPClient\StdAfx.cpp
文件 1108 2002-08-06 19:04 FTPClient\StdAfx.h
文件 1078 2002-08-06 13:24 FTPClient\res\FTPSOCKET.ico
文件 401 2002-08-06 13:24 FTPClient\res\FTPSOCKET.rc2
目录 0 2007-01-20 20:10 FTPClient\res
目录 0 2007-01-20 20:10 FTPClient\Debug
目录 0 2007-01-20 20:10 FTPClient
文件 1003 2005-07-11 16:22 FTPServer\FTPserver\AboutDlg.cpp
文件 1108 2002-03-18 11:55 FTPServer\FTPserver\AboutDlg.h
文件 2656 2002-07-30 19:29 FTPServer\FTPserver\AddIPDlg.cpp
文件 1260 2002-05-19 12:36 FTPServer\FTPserver\AddIPDlg.h
文件 1406 2002-07-10 13:34 FTPServer\FTPserver\AddUserDlg.cpp
............此处省略88个文件信息
相关资源
- vc++FTP搜索工具()
- C++实现的FTP服务器
- 一个FTP客户端的设计与实现C实现
- unix 下实现ftp部分功能lsgetput等等
- linux ftp服务器
- 基于MFC实现的FTP断点续传客户端
- C语言实现FTP服务器
- 用c语言编程ftp程序,并实现基本功能
- 基于CCS和ICETEK5509实验箱FFT算法的C语言
- FTP服务器C++代码实现
- c++实现ftp list所有文件与目录 & ftp d
- tftp_vs2010.rar
- FTP客户端程序设计(基于visual c++)
- VC++ 实现FTP客户端与服务器
- Ftp服务器与客户端VC++完整版源码
- FTP文件上传和管理类C++
- ftp客户端及服务器 mfc 网络高级程序设
- TFTP协议的C语言实现客户端和服务器
- VC++实现客户端与服务器端的文件传输
- 简单WinInet FTP客户端编程
- 非常好用的c++ ftp库源码vs2013工程
- linux下C语言实现FTP上传文件源码200行
- mfc的ftp客户端源码
- VC++通过FTP上传文件
- C++ 纯SOCKET实现FTP客户端类
- FileZilla_Server-0_9_41
- SecureFX注册机
- C语言实现ftp断点续传.rar
- FTP上传C++实现
- FTP服务器CLIENT端C语言源文件
评论
共有 条评论