資源簡介
采用socket實現(xiàn)http協(xié)議的下載,利用C++封裝,這是不可多得的例程

代碼片段和文件信息
//?Http.cpp?:?Defines?the?initialization?routines?for?the?DLL.
//
#include?“stdafx.h“
#include?“Http.h“
#ifdef?_DEBUG
#define?new?DEBUG_NEW
#undef?THIS_FILE
static?char?THIS_FILE[]?=?__FILE__;
#endif
//
// Note!
//
// If?this?DLL?is?dynamically?linked?against?the?MFC
// DLLs?any?functions?exported?from?this?DLL?which
// call?into?MFC?must?have?the?AFX_MANAGE_STATE?macro
// added?at?the?very?beginning?of?the?function.
//
// For?example:
//
// extern?“C“?BOOL?PASCAL?EXPORT?ExportedFunction()
// {
// AFX_MANAGE_STATE(AfxGetStaticModuleState());
// //?normal?function?body?here
// }
//
// It?is?very?important?that?this?macro?appear?in?each
// function?prior?to?any?calls?into?MFC.??This?means?that
// it?must?appear?as?the?first?statement?within?the?
// function?even?before?any?object?variable?declarations
// as?their?constructors?may?generate?calls?into?the?MFC
// DLL.
//
// Please?see?MFC?Technical?Notes?33?and?58?for?additional
// details.
//
/////////////////////////////////////////////////////////////////////////////
//?CHttpApp
BEGIN_MESSAGE_MAP(CHttpApp?CWinApp)
//{{AFX_MSG_MAP(CHttpApp)
//?NOTE?-?the?ClassWizard?will?add?and?remove?mapping?macros?here.
//????DO?NOT?EDIT?what?you?see?in?these?blocks?of?generated?code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
//?CHttpApp?construction
CHttpApp::CHttpApp()
{
//?TODO:?add?construction?code?here
//?Place?all?significant?initialization?in?InitInstance
///初始化Socket函數(shù)庫
int?err;
WORD?wVersion;
WSADATA?WSAData;
wVersion=MAKEWORD(20);
err=WSAStartup(wVersion&WSAData);
if(err!=0)
{
AfxMessageBox(“無法裝載Socket庫.“);
}
if(LOBYTE(?WSAData.wVersion?)?!=?2)
{
AfxMessageBox(“無法找到合適的Socket庫.“);
WSACleanup();
}
}
/////////////////////////////////////////////////////////////////////////////
//?The?one?and?only?CHttpApp?object
CHttpApp?theApp;
int?CHttpApp::ExitInstance()?
{
///清除Socket庫
WSACleanup();
return?CWinApp::ExitInstance();
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄??????????0??2004-08-01?09:35??Http
?????文件??????17992??2004-07-31?12:05??Http\Http.aps
?????文件????????349??2004-07-07?13:01??Http\Http.clw
?????文件???????2136??2004-07-07?13:01??Http\Http.cpp
?????文件????????178??2004-07-07?13:01??Http\Http.def
?????文件???????4324??2004-07-31?11:06??Http\Http.dsp
?????文件????????531??2004-07-07?13:01??Http\Http.dsw
?????文件???????1271??2004-07-07?13:01??Http\Http.h
?????文件??????82944??2004-07-30?18:09??Http\Http.ncb
?????文件??????77824??2004-07-30?18:09??Http\Http.opt
?????文件????????242??2004-07-31?12:03??Http\Http.plg
?????文件???????3053??2004-07-07?13:01??Http\Http.rc
?????文件???????1176??2004-07-07?13:01??Http\Http1_1.h
?????文件???????8277??2004-07-31?12:03??Http\HttpSocket.cpp
?????文件???????1848??2004-07-31?12:03??Http\HttpSocket.h
?????文件???????2538??2004-07-07?13:01??Http\ReadMe.txt
?????目錄??????????0??2004-07-30?18:10??Http\res
?????文件????????396??2004-07-07?13:02??Http\res\Http.rc2
?????文件????????376??2004-07-07?13:01??Http\Resource.h
?????文件???????5000??2004-07-07?13:01??Http\SocketBuffer.cpp
?????文件???????1014??2004-07-07?13:01??Http\SocketBuffer.h
?????文件????????206??2004-07-07?13:01??Http\StdAfx.cpp
?????文件???????1492??2004-07-07?13:01??Http\StdAfx.h
?????目錄??????????0??2004-08-01?09:37??TestHttp
?????目錄??????????0??2004-08-01?09:36??TestHttp\Debug
?????目錄??????????0??2004-07-31?10:21??TestHttp\Debug\Debug
?????文件?????110670??2004-07-31?12:03??TestHttp\Debug\Http.dll
?????文件?????118870??2004-08-01?09:36??TestHttp\Debug\TestHttp.exe
?????文件???????6574??2004-07-31?12:03??TestHttp\Http.lib
?????文件???????1848??2004-07-31?12:03??TestHttp\HttpSocket.h
............此處省略25個文件信息
- 上一篇:RC4在C++中運行的代碼
- 下一篇:OpenCV手勢識別-手掌特征提取源碼
評論
共有 條評論