Interacting with sockets from the application
The next project to complete is mandelbrot-app
. It will contain the QTcpServer
that will interact with the workers and the picture drawing of the Mandelbrot set. As a reminder, the diagram of the mandelbrot-app
architecture is shown here:
We will build this application from the ground up. Let's start with the class responsible for maintaining the connection with a specific Worker: WorkerClient
. This class will live in its specific QThread
and will interact with a Worker
class using the same
QTcpSocket
/QDataStream
mechanism we covered in the last section.
In mandelbrot-app
, create a new C++ class named WorkerClient
and update
WorkerClient.h
like so:
#include <QTcpSocket> #include <QList> #include <QDataStream> #include "JobRequest.h" #include "JobResult.h" #include "Message.h" class WorkerClient : public QObject { Q_OBJECT public: WorkerClient...