diff options
| author | Thomas Vanbesien <tvanbesi@proton.me> | 2026-03-24 17:25:03 +0100 |
|---|---|---|
| committer | Thomas Vanbesien <tvanbesi@proton.me> | 2026-03-24 17:29:52 +0100 |
| commit | e9d8a8b052150f42ea00da2c07e3f78a9b7d2061 (patch) | |
| tree | 2124701ae0991ed854c1a94e58d64558b6f78b48 /jetting-proxy/main.cpp | |
| parent | 8bcf948b76c9564cb38d3611228ccaf73890a548 (diff) | |
| download | QtXpl2-master.tar.gz QtXpl2-master.zip | |
Insert a transparent TCP proxy between the controller and N clients:
- JettingProxy listens on 9110-9112 (controller) and 9210-9212 (clients)
- Broadcasts controller frames to all clients, forwards client→controller
- Independent KA_PING handling on both sides
Convert Xpl2Client from passive QTcpServer listener to active QTcpSocket
outbound connections with auto-retry. New QML API: host/commandPort
properties, connectToProxy()/disconnectFromProxy() replacing
startListening()/stopListening().
Diffstat (limited to 'jetting-proxy/main.cpp')
| -rw-r--r-- | jetting-proxy/main.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/jetting-proxy/main.cpp b/jetting-proxy/main.cpp new file mode 100644 index 0000000..0e14054 --- /dev/null +++ b/jetting-proxy/main.cpp @@ -0,0 +1,37 @@ +/** + * @file main.cpp + * @brief Jetting proxy — relay between one controller and N clients. + */ +#include "JettingProxy.h" + +#include <QCommandLineParser> +#include <QCoreApplication> + +int +main (int argc, char *argv[]) +{ + qSetMessagePattern ("Proxy [%{time HH:mm:ss.zzz}] %{message}"); + + QCoreApplication app (argc, argv); + + QCommandLineParser parser; + parser.addOption ({ "wire-debug", "Log forwarded frames to dev log" }); + parser.addOption ({ "controller-port", + "Base port for controller side (default 9110)", "port", + "9110" }); + parser.addOption ({ "client-port", + "Base port for client side (default 9210)", "port", + "9210" }); + parser.addHelpOption (); + parser.process (app); + + if (parser.isSet ("wire-debug")) + JettingProxy::enableWireDebug (); + + quint16 controllerPort = parser.value ("controller-port").toUShort (); + quint16 clientPort = parser.value ("client-port").toUShort (); + + new JettingProxy (controllerPort, clientPort, &app); + + return app.exec (); +} |
