资源简介
vc实现的ftp客户端断点续传:
__fastcall TMultiFtp::TMultiFtp(TComponent* Owner)
: TComponent(Owner)
{
lock = false;
isUseFile = false;
runningThreadCnt = 0;
stop = false;
this->Owner = Owner;
}
代码片段和文件信息
//---------------------------------------------------------------------------
#include sepch.h>
#pragma hdrstop
#include “MultiFtp.h“
#pragma package(smart_init)
//---------------------------------------------------------------------------
// ValidCtrCheck is used to assure that the components created do not have
// any pure virtual functions.
//
static inline void ValidCtrCheck(TMultiFtp *)
{
new TMultiFtp(NULL);
}
//---------------------------------------------------------------------------
__fastcall TMultiFtp::TMultiFtp(TComponent* Owner)
: TComponent(Owner)
{
lock = false;
isUseFile = false;
runningThreadCnt = 0;
stop = false;
this->Owner = Owner;
}
__fastcall TMultiFtp::~TMultiFtp()
{
fclose(this->globalFile);
if(this->inforImpl.fromToImpl)
delete[] this->inforImpl.fromToImpl;
}
//---------------------------------------------------------------------------
namespace Multiftp
{
void __fastcall PACKAGE Register()
{
TComponentClass classes[1] = {__classid(TMultiFtp)};
RegisterComponents(“System“ classes 0);
}
}
//---------------------------------------------------------------------------
void __fastcall TMultiFtp::FreeMemory()
{
if(this->globalFile)
fclose(this->globalFile);
if(this->inforImpl.fromToImpl)
delete[] this->inforImpl.fromToImpl;
}
SOCKET __fastcall TMultiFtp::ConnectFtp(String host int port String userName String pass)
{
this->DoOnTextOut(“欢迎使用funinhand多线程,断点续传软件!!“);
MultiThreadDealSocket *dealSocket = new MultiThreadDealSocket();
SOCKET client = dealSocket->GetConnect(hostport);
char * buffer = new char[100];
int recLen ;
recLen = recv(clientbuffer1000);
buffer[recLen]=0;
if(client == NULL)
{
this->DoOnException(“连接ftp服务器失败!“);
delete[] buffer;
return NULL;
}
this->DoOnTextOut(“连接ftp服务器成功!“);
String user = “USER “+userName+“ \r\n“;
this->DoOnTextOut(user);
send(clientuser.c_str()user.Length()0);
recLen = recv(clientbuffer1000);
buffer[recLen]=0;
if(GetCode(buffer) == “331“)
{
this->DoOnTextOut(“服务器要求验证密码。“);
String password = “PASS “+pass+“ \r\n“;
this->DoOnTextOut(password);
send(clientpassword.c_str()password.Length()0);
recLen = recv(clientbuffer1000);
buffer[recLen]=0;
int tryTimes = 3;
while(GetCode(buffer) != “230“ && tryTimes > 0)
{
send(clientpassword.c_str()password.Length()0);
recLen = recv(clientbuffer1000);
buffer[recLen]=0;
tryTimes --;
this->DoOnTextOut(“第“+IntToStr(3-tryTimes)+“尝试“);
}
if(tryTimes < 0)
{
this->DoOnException(userName +“登录失败!“);
delete[] buffer;
return NULL;
}
else
this->
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2015-07-30 19:02 vcftp\
文件 22242 2005-01-14 20:02 vcftp\MultiFtp.cpp
文件 4585 2005-01-14 14:45 vcftp\MultiFtp.h
文件 85777 2005-01-14 20:02 vcftp\MultiFtp.obj
文件 22093 2005-01-14 20:00 vcftp\MultiFtp.~cpp
文件 4585 2005-01-14 14:45 vcftp\MultiFtp.~h
文件 7518 2005-01-14 19:34 vcftp\MultiFtpDownloadThread.cpp
文件 2203 2005-01-13 17:19 vcftp\MultiFtpDownloadThread.h
文件 45660 2005-01-14 19:34 vcftp\MultiFtpDownloadThread.obj
文件 7513 2005-01-14 19:32 vcftp\MultiFtpDownloadThread.~cpp
文件 2203 2005-01-13 17:19 vcftp\MultiFtpDownloadThread.~h
文件 332 2005-01-12 11:08 vcftp\MultiThreadDataClass.cpp
文件 666 2005-01-13 10:53 vcftp\MultiThreadDataClass.h
文件 12606 2005-01-13 10:53 vcftp\MultiThreadDataClass.obj
文件 332 2005-01-12 11:08 vcftp\MultiThreadDataClass.~cpp
文件 424 2005-01-12 11:54 vcftp\MultiThreadDataClass.~h
文件 2528 2005-01-12 10:35 vcftp\MultiThreadDealScoket.cpp
文件 532 2005-01-12 10:34 vcftp\MultiThreadDealScoket.h
文件 114150 2005-01-12 14:58 vcftp\MultiThreadDealScoket.obj
文件 1467 2005-01-12 10:32 vcftp\MultiThreadDealScoket.~cpp
文件 443 2005-01-12 10:33 vcftp\MultiThreadDealScoket.~h
相关资源
- FTP客户端C源码(Linux版)
- QT4实现的给予QFTP类的FTP客户端程序
- 计算机网络课程设计:简单FTP客户端
- FTP客户端完整版
- 网络编程---ftp客户端程序实验报告
- 基于LAN的即时通信软件,功能:登录
- 简易FTP客户端/服务端系统
- FTP客户端程序
- TFTP客户端 文件上传/实现
- linux-FTP客户端(纯C代码)
- FTP客户端的设计
- FTP客户端服务器端全部代码
- FTP客户端 源代码
- Xftp 6.0.0115 FTP/SFTP客户端绿色版保证安
- 基于qt实现的简单FTP客户端
- TFTP客户端服务器程序
- ftp客户端 实例源码下载24903
- 计算机网络课程设计ftp协议客户端和
- 计算机实验 Socket编程 FTP客户端源程序
- FTP客户端程序设计
评论
共有 条评论