-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.cpp
More file actions
36 lines (30 loc) · 851 Bytes
/
server.cpp
File metadata and controls
36 lines (30 loc) · 851 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 <iostream>
#include <chrono>
#include "http_win_server.h"
int main(int argc, char** argv)
{
using namespace std::this_thread;
using namespace std::chrono_literals;
using std::chrono::system_clock;
try {
if (argc != 4)
{
for (int i = 0; i < argc; ++i)
{
std::cerr << argv[i] << '\n';
}
throw("\n!E!Invalid argument count.\nExample: '<ip> <port> <rootdir>, 127.0.0.1 8080 path\\'");
}
const auto ip = boost::asio::ip::make_address(argv[1]);
const auto port = std::stoi(argv[2]);
const std::string dir_root(argv[3]);
rhttp::server server1;
server1.start(ip, port, dir_root);
}
catch (const char* ex)
{
std::cout << "Error What: " << ex << '\n';
return -1;
}
return 0;
}