91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡(jiǎn)介

VC++6.0寫的網(wǎng)絡(luò)爬蟲程序,多線程,生成文件,很不錯(cuò)的學(xué)習(xí)資料,轉(zhuǎn)載的~謝謝

資源截圖

代碼片段和文件信息

////////////////////////////////////////////////////
//設(shè)計(jì)者姓名:LWZ小組?劉克東?00348231
//項(xiàng)目名:大實(shí)習(xí)-搜索引擎-網(wǎng)絡(luò)化爬蟲
//創(chuàng)建日期:2004-12-10
//最近一次修改日期:2004-12-26
//
//?DownloadData.cpp:?implementation?of?the?DownloadData?class.
//
//////////////////////////////////////////////////////////////////////

#include?“stdafx.h“
#include?“NetCrawler.h“

#include?“afxmt.h“
#include?“DownloadData.h“


#ifdef?_DEBUG
#undef?THIS_FILE
static?char?THIS_FILE[]=__FILE__;
#define?new?DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
//?Construction/Destruction
//////////////////////////////////////////////////////////////////////

DownloadData::DownloadData()
{
uCur_URLnum=0; //初始化當(dāng)前隊(duì)列中URL數(shù)量為0
uMaxSizeOfContainer=4000; //URL隊(duì)列最大容量
uCur_URLptr=0; //當(dāng)前隊(duì)列頭部指針
uCur_ActiveThread=0; //當(dāng)前活動(dòng)線程數(shù)量為0
uMaxThreadNum=10; //初始化線程數(shù)目10
uCur_Fileid=1; //初始化本地文件名稱為1
str_LocalDir=“C:\\“; //初始化本地文件目錄為C:
}


DownloadData::~DownloadData()
{
}
//是否URL隊(duì)列已經(jīng)滿了
bool?DownloadData::IsEmpty()
{
criSection.Lock();
bool?r=(uCur_URLnum<=uCur_URLptr);
criSection.Unlock();
return?r;
}
//是否URL已經(jīng)存在于隊(duì)列中
bool?DownloadData::IsExisted(CString?&str)
{
criSection.Lock();
for(UINT?i=0;i {
if(URLcontainer[i]==str)
{
criSection.Unlock();
return?TRUE;
}
}
criSection.Unlock();
return?FALSE;
}
//是否URL隊(duì)列空了(無未處理的URL)
bool?DownloadData::IsFull()
{
criSection.Lock();
bool?r=(uCur_URLnum==uMaxSizeOfContainer);
criSection.Unlock();
return?r;
}
//獲得當(dāng)前活動(dòng)線程數(shù)目
UINT?DownloadData::GetCurThread()
{
criSection.Lock();
UINT?n=uCur_ActiveThread;
criSection.Unlock();
return?n;
}
//獲得最大線程數(shù)目
UINT?DownloadData::GetMaxThreadnum()
{
return?uMaxThreadNum;
}
//線程開始,向數(shù)據(jù)區(qū)添加一個(gè)線程記錄成功返回true
bool?DownloadData::AddThread()
{
criSection.Lock();
if(uCur_ActiveThread==uMaxThreadNum)
{
criSection.Unlock();
return?FALSE;
}
uCur_ActiveThread++;
criSection.Unlock();
return?TRUE;
}
//線程結(jié)束后,從數(shù)據(jù)區(qū)刪除一個(gè)線程記錄,成功返回true
bool?DownloadData::DeleThread()
{
criSection.Lock();
if(uCur_ActiveThread==0)
{
criSection.Unlock();
return?FALSE;
}
uCur_ActiveThread--;
criSection.Unlock();
return?TRUE;
}
//從共享數(shù)據(jù)區(qū)URL隊(duì)列頭取出一個(gè)URL
bool?DownloadData::GetCurURL(CString?&str)
{
criSection.Lock();
if(uCur_URLptr>=uCur_URLnum)
{
criSection.Unlock();
return?FALSE;
}
str=URLcontainer[uCur_URLptr];
uCur_URLptr++;
criSection.Unlock();
return?TRUE;

}
//向共享數(shù)據(jù)區(qū)URL隊(duì)列尾添加一個(gè)URL
bool?DownloadData::AddURL(CString?&str)
{
criSection.Lock();
if(uCur_URLnum==uMaxSizeOfContainer)
{
criSection.Unlock();
return?FALSE;
}
URLcontainer[uCur_URLnum]=str;
uCur_URLnum++;
criSection.Unlock();
return?FALSE;

}
//獲得當(dāng)前本地存儲(chǔ)文件的地址
void?DownloadData::GetFileName(CString?&str)
{
criSection.Lock();
CString?str_temp;
str_temp.Format(“%d“uCur_Fileid);
str=str_LocalDir+str_temp+“.txt“;
uCur_Fileid++;
criSection.Unlock();
}

//根據(jù)用

?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----

?????文件????????402??2004-12-13?23:33??res\NetCrawler.rc2

?????文件???????1078??2004-12-13?23:33??res\NetCrawler.ico

????..A.SH.??????3072??2007-05-22?21:05??res\Thumbs.db

?????文件???????3633??2007-05-22?10:10??DownloadData.cpp

?????文件???????2771??2007-05-22?15:11??DownloadData.h

?????文件??????13964??2007-05-22?19:14??MainThread.cpp

?????文件???????2463??2007-05-22?15:11??MainThread.h

?????文件??????22876??2007-05-22?10:03??NetCrawler.aps

?????文件???????2760??2007-05-22?20:02??NetCrawler.clw

?????文件???????3538??2007-05-22?10:10??NetCrawler.cpp

?????文件???????4736??2004-12-20?17:12??NetCrawler.dsp

?????文件????????545??2004-12-13?23:33??NetCrawler.dsw

?????文件???????1554??2004-12-25?20:53??NetCrawler.h

?????文件??????56832??2007-05-22?19:29??NetCrawler.opt

?????文件???????1574??2007-05-22?15:12??NetCrawler.plg

?????文件???????7620??2004-12-25?00:37??NetCrawler.rc

?????文件???????7304??2007-05-22?13:20??NetCrawlerDlg.cpp

?????文件???????2707??2007-05-22?13:20??NetCrawlerDlg.h

?????文件???????3627??2007-05-22?13:20??ProjectDlg.cpp

?????文件???????2118??2007-05-22?13:20??ProjectDlg.h

?????文件???????3651??2004-12-13?23:33??ReadMe.txt

?????文件???????1377??2004-12-25?00:28??Resource.h

?????文件????????212??2004-12-13?23:33??StdAfx.cpp

?????文件???????1054??2004-12-13?23:33??StdAfx.h

?????目錄??????????0??2007-05-22?10:03??res

-----------?---------??----------?-----??----

???????????????151686????????????????????26


評(píng)論

共有 條評(píng)論