Files
frelay/Server/main.cpp

34 lines
772 B
C++
Raw Normal View History

2025-06-20 10:33:03 +08:00
#include <QCoreApplication>
2025-06-29 17:05:31 +08:00
#include <QDir>
2025-06-20 10:33:03 +08:00
#include <Util.h>
2025-10-20 15:22:38 +08:00
#include <fversion.h>
#include <iostream>
2025-06-14 09:27:50 +08:00
#include "Server.h"
int main(int argc, char* argv[])
{
2025-10-20 15:22:38 +08:00
auto ver = QString("%1 %2 on %3").arg(VERSION_NUM, VERSION_GIT_COMMIT, VERSION_GIT_BRANCH);
std::cout << ver.toStdString() << std::endl;
2025-06-29 22:13:42 +08:00
int port = 9009;
if (argc < 2) {
qDebug() << "Usage: frelayServer port.";
} else {
port = atoi(argv[1]);
}
2025-06-14 09:27:50 +08:00
QCoreApplication app(argc, argv);
Util::InitLogger("frelayServer.log", "frelayServer");
qInstallMessageHandler(Util::ConsoleMsgHander);
2025-06-14 09:27:50 +08:00
Server server;
2025-06-29 22:13:42 +08:00
if (!server.startServer(port)) {
2025-06-14 09:27:50 +08:00
return 1;
}
qDebug() << "TCP server is running. Press Ctrl+C to exit...";
return app.exec();
}