-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathCrawlerTest.cpp
More file actions
37 lines (31 loc) · 1.58 KB
/
CrawlerTest.cpp
File metadata and controls
37 lines (31 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*******************************Copyright (c)*********************************************
**Copyright Owner: Cory Tang
**Department: University of Electronic Science and Technology of China
**Email: chong.tang@live.cn
**--------------------------- File Info ---------------------------------------------------
** File name: CrawlerTest.cpp
** Last modified Date: 2013-08-29
** Last Version: 0.1
** Descriptions: Test example of the class Crawler.
** Based on Linux 2.6.36.
**------------------------------------------------------------------------------------------
** Created by: Cory Tang
** Created date: 2013-08-05
**------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
** Version:
** Descriptions:
*******************************************************************************************/
#include "Crawler.h"
int main()
{
Crawler* pCrawler = Crawler::crawler_get_instance(20, 10000); //Create a crawler with a thread pool including 20 threads, and its job queue can store 10000 urls waiting to be crawled at most.
pCrawler->crawler_add_url("http://www.boost.org/"); //Add a good url seed for test
pCrawler->crawler_add_url("http://www.bad-url.net/"); //Add a non-existed url seed for test
//alarm(1000); The crawler progress will be aborted after 1000 seconds.
//Or call pCrawler->crawler_exit() to exit the crawler actively, whenever you want.
//Here for test just using while(1) to let the crawler keep crawling.
while(1);
return 0;
}