资源简介
内容索引:VC/C++源码,网络相关,FTP
Ftp客户端与服务器VC++完整版,是一个比较简单的ftp程序,但是程序提供了各种接口,能够让读者看法出各种复杂的ftp程序,程序中的各个程序模块均已经实现,以上所有程序在VC6.0中调试通过
目录ftp服务器是一个基于控制台的ftp服务器程序,能够实现大部分的FTP的服务器程序;
注意:
a.帐号密码为toldo;
b.主目录为c:/temp,在连接之前请先建立;
代码片段和文件信息
/*/////////////////////////////////////////////////////////////////////
FTPclient.cpp (c) GDI 1999
V1.0.0 (10/4/99)
Phil Anderson. philip@gd-ind.com
Download by http://www.codefans.net
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
/////////////////////////////////////////////////////////////
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
----------- --------- ---------- ----- ----
123355 30
- 上一篇:高校人事管理系统C++程序设计
- 下一篇:C语言100个经典算法题目+源码
相关资源
- C语言100个经典算法题目+源码
- 高校人事管理系统C++程序设计
- 贪心算法编写的01背包问题c/c++
- C++课程设计大作业
- 解决System.Data.SQLite兼容32位和64位问题
- 新标准C++程序设计教材11-20章课后题答
- 复数矩阵 解方程组 C++源代码
- C++课件C++课件C++课件
- 自己写的Apriori算法c++实现
- 网速监控 v1.2 MFC VC C++ 网速监控 线程
- 舞伴伴舞问题的C++实现
- rrt实现图片搜索.zip
- 用VC++显示图像的灰度直方图
- VC++开发基于Microsoft Speech SDK的TTS软件
- cc++项目视频.txt
- c++ primer plus 第六版 课后习题答案
- FTP文件上传和管理类C++
- c++builder做图像处理项目的核心代码
- c++标准库函数中文chm
- C++ curl封装类
- iar.cc++.compiler.v1.30.3.50673.for.rl78-patch
- Bloom过滤器的C++实现
- C++实现数据结构源代码
- Intel C++ Compiler 9 10 11 license Key 注册文
- c++职工信息管理系统课程设计报告
- 检查抄袭作业程序
- VC++ MFC入门精讲.PPT
- 数据结构校园导航系统
- 国际象棋c++完整版
- 课程设计-学生成绩管理系统设计C++
评论
共有 条评论