tcpserver.h 783 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #ifndef TCPSERVER_H
  2. #define TCPSERVER_H
  3. #include <QObject>
  4. #include <QDateTime>
  5. #include <QTcpServer>
  6. #include <QTcpSocket>
  7. #include <QNetworkAccessManager>
  8. #include <QNetworkRequest>
  9. #include <QNetworkReply>
  10. #include <QSslConfiguration>
  11. #include <QVariant>
  12. #include <QJsonDocument>
  13. #include <QJsonObject>
  14. #include <QJsonValue>
  15. #include <QJsonParseError>
  16. class TcpServer : public QObject
  17. {
  18. Q_OBJECT
  19. public:
  20. explicit TcpServer(QObject *parent = nullptr);
  21. void start();
  22. signals:
  23. void tcp_log(QString log);
  24. public slots:
  25. void new_incomming();
  26. void read_data();
  27. void finishedSlot(QNetworkReply *reply);
  28. private:
  29. QTcpServer *svr;
  30. QTcpSocket *so;
  31. QNetworkAccessManager *networkManager;
  32. QSslConfiguration config;
  33. };
  34. #endif // TCPSERVER_H