123456789101112131415161718192021222324252627282930313233343536 |
- #ifndef HTTPSERVER_H
- #define HTTPSERVER_H
- #include <QObject>
- #include <QtCore>
- #include <QtNetwork>
- #include <QMutex>
- class HttpServer : public QObject
- {
- Q_OBJECT
- public:
- static HttpServer &instance();
- void run(const QHostAddress &address = QHostAddress::Any,const quint16 &port = 6122);
- signals:
- public slots:
- private slots:
- void newConnection();
- void readyRead();
- private:
- explicit HttpServer(QObject *parent = nullptr);
- ~HttpServer();
- Q_DISABLE_COPY(HttpServer)
- private:
- QTcpServer *m_httpServer;
- private:
- QByteArray mba;
- QMutex mMutex;
- public:
- QByteArray GetData();
- };
- #endif // HTTPSERVER_H
|