tcp.h 663 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #ifndef TCP_H
  2. #define TCP_H
  3. #include <QMainWindow>
  4. #include <QTcpServer>
  5. #include <QTcpSocket>
  6. #include <QLabel>
  7. #include <QFile>
  8. namespace Ui {
  9. class tcp;
  10. }
  11. class tcp : public QMainWindow
  12. {
  13. Q_OBJECT
  14. public:
  15. explicit tcp(QWidget *parent = nullptr);
  16. ~tcp();
  17. private slots:
  18. void on_setListen_clicked();
  19. void connectClient(QTcpSocket *clientSocket);
  20. void on_sendMsg_clicked();
  21. private:
  22. Ui::tcp *ui;
  23. QTcpServer* ms;
  24. QTcpSocket* mtcp;
  25. QLabel* mstatus;
  26. // QFile *file;
  27. QMap<QTcpSocket*, QString> connectedClients;
  28. QString sendname;
  29. int connectNum;
  30. int clientIdentifierCounter = 1;
  31. };
  32. #endif // TCP_H