#include "server.h"
#include "version.h"
#include <iostream>

int main(int argc, char* argv[])
{
    mpinfo("Build At {} {} under {} on {}", __DATE__, __TIME__, VERSION_GIT_COMMIT, VERSION_GIT_BRANCH);
    int port = 9898;
    if (argc < 2) {
        mpinfo("Use Default Port:{}", port);
    } else {
        std::string str_port(argv[1]);
        port = std::stoi(str_port);
        mpinfo("Use Port:{}", port);
    }
    asio::io_context io_context;
    CTcpServer server(io_context);
    if (!server.start(port)) {
        return -1;
    }
    io_context.run();
    return 0;
}