From 60a301a93b6057bb2c54ac04a7c38c38389037b3 Mon Sep 17 00:00:00 2001 From: Dark1-dev Date: Wed, 1 Mar 2023 21:30:57 +0600 Subject: Add files via upload --- src/TcpTasks/SyncClient/syncclient.h | 50 ++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 src/TcpTasks/SyncClient/syncclient.h (limited to 'src/TcpTasks/SyncClient/syncclient.h') diff --git a/src/TcpTasks/SyncClient/syncclient.h b/src/TcpTasks/SyncClient/syncclient.h new file mode 100644 index 0000000..8cf253f --- /dev/null +++ b/src/TcpTasks/SyncClient/syncclient.h @@ -0,0 +1,50 @@ +#ifndef SYNCCLIENT_H +#define SYNCCLIENT_H + +#include +#include +#include + +#include "Core/CoreObject/coreobject.h" +#include "Database/Common/commonactions.h" +#include "Protocols/GameSpy0/gamespy0.h" +#include "Protocols/GameSpy0/securevalidate.h" + +class SyncClient: public QObject +{ + Q_OBJECT +public: + SyncClient(const QSharedPointer &coreObject, + const QString &remoteHost, + const unsigned short int &remotePort); + +private: + QSharedPointer _coreObject; + const int _timeOutTime_ms = 7500; + + // tcp client handles + QTcpSocket _tcpSocket; + QTimer _timeOut; + QString _rxBuffer = ""; + QString _clientLabel; + + // helpers + int _queryId = 0; + + // functions + QStringList replyQuery(const QMultiHash &query); + +private: // update sync time in database + bool updateSyncedServer(const QString &serverAddress, + const unsigned short &serverPort); + +private slots: + void onSyncConnect(); + void onSyncRead(); + void onSyncDisconnect(); + void onSyncTimeOut(); + +signals: +}; + +#endif // SYNCCLIENT_H -- cgit v1.2.3