17 #include <QtCore/QObject> 18 #include <QtCore/QScopedPointer> 19 #include <QtCore/QTimer> 20 #include <QtNetwork/QTcpSocket> 21 #include <QtNetwork/QHostAddress> 61 bool isConnected()
const;
70 QHostAddress peerAddress()
const;
78 Q_INVOKABLE
void init(qintptr socketDescriptor);
81 Q_INVOKABLE
void send(
const QByteArray &data);
94 void init(
const QHostAddress &ip,
int port);
107 void onError(QAbstractSocket::SocketError error);
113 void onHeartbeatTimeout();
117 virtual void processData(
const QByteArray &data) = 0;
120 void handleIncomingData(
const QByteArray &data);
126 void processBuffer();
132 void initKeepalive();
138 int mExpectedBytes = 0;
144 QScopedPointer<QTimer> mKeepAliveTimer;
147 QScopedPointer<QTimer> mHeartbeatTimer;
150 bool mDisconnectReported =
false;
153 bool mUseHeartbeat =
false;
156 QScopedPointer<QTcpSocket> mSocket;
static const int port
Definition: trikCommunicatorTest.cpp:24
Wait for a packet every N milliseconds, if none is received, assume connection lost and close socket...
Heartbeat
Heartbeat protocol option.
Definition: connection.h:38
Protocol
Connection protocol variants.
Definition: connection.h:28
Definition: trikCommunicator.h:31
#define TRIKNETWORK_EXPORT
Definition: declSpec.h:23
Message is in form "<data length in bytes>:<data>".
Abstract class that serves one client of TrikServer.
Definition: connection.h:50