forked from ts-way/PassiveNetwork
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtcpserver.h
43 lines (33 loc) · 756 Bytes
/
tcpserver.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
#ifndef TCPSERVER_H
#define TCPSERVER_H
#include <QObject>
#include <QTcpServer>
#include <QTcpSocket>
#include <QNetworkInterface>
class TCPServer : public QObject
{
Q_OBJECT
public:
explicit TCPServer(QObject *parent = 0);
void setPort(quint16);
void start();
QString getRemoteIp();
quint16 getRemotePort();
QTcpServer server;
quint16 port;
QTcpSocket *client;
signals:
void stringRead(QByteArray);
void connectionError(QString);
void connectionReady();
void connectionNotReady();
public slots:
void newConnection();
void endConnection();
void clientWriteString(QByteArray);
QByteArray clientReadString();
void stop();
void clientStop();
private:
};
#endif // TCPSERVER_H