blob: d590a59f926d5e3ecfa85345fe213854953d5ff1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
// -*- c++ -*-
#pragma once
#include <QtCore>
#include <QtNetwork>
class QTcpSocket;
class QTimer;
class Client
: public QObject
{
Q_OBJECT
public:
Client(QObject *parent = 0);
public slots:
bool connectToHost(const QString& host);
bool writeData(const QByteArray& data);
void errorOccurred(QAbstractSocket::SocketError socketError);
void connected();
void disconnected();
void timeout();
signals:
void isConnected();
void isDisconnected();
private:
void retryConnect();
QTcpSocket *socket;
QString host;
QTimer *timer;
int retries{10};
int interval{5};
int interval_long{120};
};
|