資源簡介
用MFC實現的FTP斷點上傳與下載的程序,可以正常運行,無論是學習還是拿到項目中使用都很好!

代碼片段和文件信息
//---------------------------------------------------------------------------
#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->
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????22242??2005-01-14?20:02??ftp協議實現多線程斷點續傳\200641016517684\ftp協議實現多線程斷點續傳\project\MultiFtp.cpp
?????文件???????4585??2005-01-14?14:45??ftp協議實現多線程斷點續傳\200641016517684\ftp協議實現多線程斷點續傳\project\MultiFtp.h
?????文件??????85777??2005-01-14?20:02??ftp協議實現多線程斷點續傳\200641016517684\ftp協議實現多線程斷點續傳\project\MultiFtp.obj
?????文件??????22093??2005-01-14?20:00??ftp協議實現多線程斷點續傳\200641016517684\ftp協議實現多線程斷點續傳\project\MultiFtp.~cpp
?????文件???????4585??2005-01-14?14:45??ftp協議實現多線程斷點續傳\200641016517684\ftp協議實現多線程斷點續傳\project\MultiFtp.~h
?????文件???????7518??2005-01-14?19:34??ftp協議實現多線程斷點續傳\200641016517684\ftp協議實現多線程斷點續傳\project\MultiFtpDownloadThread.cpp
?????文件???????2203??2005-01-13?17:19??ftp協議實現多線程斷點續傳\200641016517684\ftp協議實現多線程斷點續傳\project\MultiFtpDownloadThread.h
?????文件??????45660??2005-01-14?19:34??ftp協議實現多線程斷點續傳\200641016517684\ftp協議實現多線程斷點續傳\project\MultiFtpDownloadThread.obj
?????文件???????7513??2005-01-14?19:32??ftp協議實現多線程斷點續傳\200641016517684\ftp協議實現多線程斷點續傳\project\MultiFtpDownloadThread.~cpp
?????文件???????2203??2005-01-13?17:19??ftp協議實現多線程斷點續傳\200641016517684\ftp協議實現多線程斷點續傳\project\MultiFtpDownloadThread.~h
?????文件????????332??2005-01-12?11:08??ftp協議實現多線程斷點續傳\200641016517684\ftp協議實現多線程斷點續傳\project\MultiThreadDataClass.cpp
?????文件????????666??2005-01-13?10:53??ftp協議實現多線程斷點續傳\200641016517684\ftp協議實現多線程斷點續傳\project\MultiThreadDataClass.h
?????文件??????12606??2005-01-13?10:53??ftp協議實現多線程斷點續傳\200641016517684\ftp協議實現多線程斷點續傳\project\MultiThreadDataClass.obj
?????文件????????332??2005-01-12?11:08??ftp協議實現多線程斷點續傳\200641016517684\ftp協議實現多線程斷點續傳\project\MultiThreadDataClass.~cpp
?????文件????????424??2005-01-12?11:54??ftp協議實現多線程斷點續傳\200641016517684\ftp協議實現多線程斷點續傳\project\MultiThreadDataClass.~h
?????文件???????2528??2005-01-12?10:35??ftp協議實現多線程斷點續傳\200641016517684\ftp協議實現多線程斷點續傳\project\MultiThreadDealScoket.cpp
?????文件????????532??2005-01-12?10:34??ftp協議實現多線程斷點續傳\200641016517684\ftp協議實現多線程斷點續傳\project\MultiThreadDealScoket.h
?????文件?????114150??2005-01-12?14:58??ftp協議實現多線程斷點續傳\200641016517684\ftp協議實現多線程斷點續傳\project\MultiThreadDealScoket.obj
?????文件???????1467??2005-01-12?10:32??ftp協議實現多線程斷點續傳\200641016517684\ftp協議實現多線程斷點續傳\project\MultiThreadDealScoket.~cpp
?????文件????????443??2005-01-12?10:33??ftp協議實現多線程斷點續傳\200641016517684\ftp協議實現多線程斷點續傳\project\MultiThreadDealScoket.~h
?????文件????????155??2007-08-20?23:31??ftp協議實現多線程斷點續傳\200641016517684\ftp協議實現多線程斷點續傳\project\龍騰教程網--軟件教程?電腦教程?設計教程.url
?????目錄??????????0??2006-04-10?16:42??ftp協議實現多線程斷點續傳\200641016517684\ftp協議實現多線程斷點續傳\project
?????文件????????155??2007-08-20?23:31??ftp協議實現多線程斷點續傳\200641016517684\ftp協議實現多線程斷點續傳\龍騰教程網--軟件教程?電腦教程?設計教程.url
?????目錄??????????0??2006-04-10?16:42??ftp協議實現多線程斷點續傳\200641016517684\ftp協議實現多線程斷點續傳
?????文件????????155??2007-08-20?23:31??ftp協議實現多線程斷點續傳\200641016517684\龍騰教程網--軟件教程?電腦教程?設計教程.url
?????目錄??????????0??2006-04-25?22:04??ftp協議實現多線程斷點續傳\200641016517684
?????目錄??????????0??2007-09-05?23:32??ftp協議實現多線程斷點續傳
-----------?---------??----------?-----??----
???????????????338324????????????????????27
............此處省略0個文件信息
- 上一篇:mfc生成excel-pdf圖表
- 下一篇:圖像處理-讀取bmp圖像均值濾波-C++
評論
共有 條評論