-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtcpclient.h
More file actions
36 lines (28 loc) · 737 Bytes
/
Copy pathtcpclient.h
File metadata and controls
36 lines (28 loc) · 737 Bytes
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
#ifndef TCPCLIENT_H
#define TCPCLIENT_H
#include <QObject>
#include <QTcpSocket>
class TcpClient : public QObject
{
Q_OBJECT
public:
TcpClient(QObject *parent = nullptr);
~TcpClient();
signals:
void showResponse(const QByteArray &response);
void confirmTcpConnection(bool isConnected);
void quitTcpClient();
private:
QTcpSocket* tcpSocket;
private slots:
void slotReadyRead();
void slotError(QAbstractSocket::SocketError);
void slotConnected();
void slotDisconnected();
public slots:
void onClientStart();
void onSetTcpConnection(const QString &hostName, quint16 port);
void onSetTcpDisconnection();
void onSendToServer(const QByteArray &msg);
};
#endif // TCPCLIENT_H