-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
31 lines (30 loc) · 850 Bytes
/
main.cpp
File metadata and controls
31 lines (30 loc) · 850 Bytes
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
#include "main.h"
int main(int argc, char **argv){
if(argc==3){
MyServer s(atoi(argv[2]), argv[1]);
string rbuff;
//MyThreadPool mtp(10);
HttpHandler * hd;
MySocket* sfd;
vector<MySocket*> sfdlist;
while(1){
sfdlist = s.selectaccept();
for(int i=0; i<sfdlist.size(); i++){
sfd = sfdlist[i];
sfd->myread(rbuff);
HttpHandler hdnopool(sfd,rbuff);
hdnopool.run();
rbuff.clear();
}
//sfd = s.myaccept();
/*if(sfd && sfd>=0){
sfd->myread(rbuff);
//hd = new HttpHandler(sfd, rbuff);
//mtp.addtask(hd);
hd->run();
rbuff.clear();
}*/
}
}
return 0;
}