2024-12-12 22:43:24 +08:00
|
|
|
#include "server.h"
|
2024-12-16 14:21:39 +08:00
|
|
|
#include "version.h"
|
2024-12-14 19:49:44 +08:00
|
|
|
#include <iostream>
|
|
|
|
|
2024-12-16 09:40:57 +08:00
|
|
|
int main(int argc, char* argv[])
|
2024-12-11 08:44:14 +08:00
|
|
|
{
|
2025-01-21 21:43:09 +08:00
|
|
|
mpinfo("Build At {} {} under {} on {}", __DATE__, __TIME__, VERSION_GIT_COMMIT, VERSION_GIT_BRANCH);
|
2024-12-16 09:40:57 +08:00
|
|
|
int port = 9898;
|
|
|
|
if (argc < 2) {
|
2025-01-21 21:43:09 +08:00
|
|
|
mpinfo("Use Default Port:{}", port);
|
2024-12-16 14:21:39 +08:00
|
|
|
} else {
|
2024-12-16 09:40:57 +08:00
|
|
|
std::string str_port(argv[1]);
|
|
|
|
port = std::stoi(str_port);
|
2025-01-21 21:43:09 +08:00
|
|
|
mpinfo("Use Port:{}", port);
|
2024-12-16 09:40:57 +08:00
|
|
|
}
|
2024-12-12 23:11:55 +08:00
|
|
|
asio::io_context io_context;
|
2025-01-21 21:43:09 +08:00
|
|
|
CTcpServer server(io_context);
|
2024-12-16 09:40:57 +08:00
|
|
|
if (!server.start(port)) {
|
2024-12-12 23:11:55 +08:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
io_context.run();
|
2024-12-11 08:44:14 +08:00
|
|
|
return 0;
|
|
|
|
}
|