From 0243cbe0170a768f8f8998c6f7f234869c8c77e6 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sat, 30 Apr 2022 10:06:28 +0200 Subject: Add 4-byte size arg to socket payload. Add qookie-cast client (server really) with receiving socket. --- src/qookie-cast-client.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/qookie-cast-client.h (limited to 'src/qookie-cast-client.h') diff --git a/src/qookie-cast-client.h b/src/qookie-cast-client.h new file mode 100644 index 0000000..766b48b --- /dev/null +++ b/src/qookie-cast-client.h @@ -0,0 +1,34 @@ +// -*- c++ -*- +#include +#include + +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) +// Qt4 support +#include +using WebView = QWebView; +#else +#include +using WebView = QTextEdit; +#endif + +class Server + : public QObject +{ + Q_OBJECT +public: + Server(WebView& webview, QObject *parent = 0); + +signals: + void dataReceived(QByteArray); + +private slots: + void newConnection(); + void disconnected(); + void readyRead(); + +private: + QTcpServer *server; + WebView& webview; + QString html; + int size{-1}; +}; -- cgit v1.2.3