-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtcpserver.h
More file actions
30 lines (27 loc) · 782 Bytes
/
tcpserver.h
File metadata and controls
30 lines (27 loc) · 782 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
#ifndef TCPSERVER_H
#define TCPSERVER_H
#include <QMap>
#include <QTcpServer>
#include <QTcpSocket>
class TcpServer : public QTcpServer
{
Q_OBJECT
public:
TcpServer(QObject *parent = nullptr);
~TcpServer() override;
QMap<qintptr, QTcpSocket*> linkList;
//QMap<qintptr, QString> stringList;
int getClientNum();
private:
int clientNum;
signals:
void newSocketConnected(int socketDescriptor);
void socketDisconnected(int socketDescriptor);
void sendData(int socketDescriptor, QString data);
protected:
int getLinkListSize(qintptr socketDescriptor);
void incomingConnection(qintptr socketDescriptr) override;
void disconnectSocket(qintptr socketDescriptor);
void readData(qintptr socketDescriptor);
};
#endif // TCPSERVER_H