-
Notifications
You must be signed in to change notification settings - Fork 2
/
client.h
50 lines (37 loc) · 848 Bytes
/
client.h
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
39
40
41
42
43
44
45
46
47
48
49
50
///
/// Created by Igorfel 20/04/16
///
#ifndef CLIENT_H
#define CLIENT_H
#include <QtNetwork>
#include <QObject>
#include <QString>
#include <QTcpSocket>
#include <QHostAddress>
class Client: public QObject
{
Q_OBJECT
public:
explicit Client (QObject *parent = 0);
Client (QString address = "", quint16 port = 0);
~Client ();
void Connect2Host(QString address, quint16 port);
void DisconnectFromHost();
bool writeData(QString str);
bool isConneted();
QString dataReceived();
private:
bool hasConnection;
QTcpSocket socket;
QString bytesReaded;
QNetworkSession *networkSession;
void Init();
void registerSlots();
signals:
void hasReadData();
void connectionSuccessful();
private slots:
void readData();
void Awake();
};
#endif // CLIENT_H