-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclientthread.h
More file actions
61 lines (52 loc) · 1.21 KB
/
clientthread.h
File metadata and controls
61 lines (52 loc) · 1.21 KB
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
51
52
53
54
55
56
57
58
59
60
61
#ifndef FORTUNETHREAD_H
#define FORTUNETHREAD_H
#include <QThread>
#include <QTcpSocket>
#include <QDataStream>
/**
* \class EtaNetThread
*
* \brief A EtaNetThread provides a way to manage threads.
*
* For each connection will be create a new thread. Each thread handle a incomming message from the clients.
*/
class EtaNetThread : public QThread
{
Q_OBJECT
public:
/**
* @brief Constructor
*/
EtaNetThread(int socketDescriptor, QObject *parent);
/**
* @brief After calling start(), the newly created thread calls this virtual function.
*
*/
void run() override;
signals:
/**
* @brief Is used for displaying socket errors
*
*/
void error(QTcpSocket::SocketError socketError);
private slots:
/**
* @brief Is used for start transactions between server and client
*
*/
void read();
private:
/**
* @brief data stream - is a binary stream of encoded information
*/
QDataStream in;
/**
* @brief TCP socket - provides a TCP socket
*/
QTcpSocket* tcpSocket;
/**
* @brief socket descriptor - is the native socket descriptor for the accepted connection
*/
int socketDescriptor;
};
#endif