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-23 09:46:54 +08:00
|
|
|
auto ver = Util::GetVersion();
|
|
|
|
|
std::cout << "==============> " << ver.toStdString() << std::endl;
|
2025-10-20 15:22:38 +08:00
|
|
|
|
2025-06-29 22:13:42 +08:00
|
|
|
int port = 9009;
|
|
|
|
|
if (argc < 2) {
|
2025-11-05 09:35:36 +08:00
|
|
|
qInfo() << "==============> Usage: frelayServer port.";
|
2025-06-29 22:13:42 +08:00
|
|
|
} else {
|
|
|
|
|
port = atoi(argv[1]);
|
|
|
|
|
}
|
2025-06-20 16:20:34 +08:00
|
|
|
|
2025-06-14 09:27:50 +08:00
|
|
|
QCoreApplication app(argc, argv);
|
|
|
|
|
|
2025-06-15 20:37:25 +08:00
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-05 09:35:36 +08:00
|
|
|
qInfo() << "TCP server is running. Press Ctrl+C to exit...";
|
2025-06-14 09:27:50 +08:00
|
|
|
|
|
|
|
|
return app.exec();
|
|
|
|
|
}
|