tcpserver.h 532 B

1234567891011121314151617181920212223242526272829
  1. #ifndef TCP_SERVER_H
  2. #define TCP_SERVER_H
  3. #include <QTcpServer>
  4. #include <QHostAddress>
  5. class TcpServer : public QTcpServer
  6. {
  7. Q_OBJECT
  8. public:
  9. explicit TcpServer(const QHostAddress host, const quint16 port);
  10. virtual ~TcpServer();
  11. QByteArray data() const;
  12. QTcpSocket* socket() const;
  13. static const QHostAddress HOST;
  14. static const quint16 PORT;
  15. protected:
  16. QTcpSocket* _socket;
  17. QByteArray _data;
  18. protected slots:
  19. void on_newConnection();
  20. void on_readyRead();
  21. };
  22. #endif // TCP_SERVER_H