-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
36 lines (27 loc) · 889 Bytes
/
Copy pathmain.cpp
File metadata and controls
36 lines (27 loc) · 889 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
32
33
34
35
36
#include "main.h"
int main(int argc, char *argv[])
{
try
{
if (argc != 3)
{
std::cerr << "Usage: " << argv[0] << " <address> <port> \n";
std::cerr << " Server 0.0.0.0 80 \n";
}
std::cout << "Start server. \n";
net::ip::address serverIP = net::ip::make_address(argv[1]);
unsigned short serverPort = static_cast<unsigned short>(std::atoi(argv[2]));
net::io_context ioc{1};
tcp::acceptor acceptor{ioc, {serverIP, serverPort}};
tcp::socket socket{ioc};
std::shared_ptr<Collector::FileCollector> fileCollector =
std::make_shared<Collector::FileCollector>();
ownHTTPServer::start_acceptor(acceptor, socket, fileCollector);
ioc.run();
}
catch(const std::exception& e)
{
std::cerr << e.what() << '\n';
}
return 0;
}