Hello

I have the following code:

Below is a Worker class which is QRunnable object. As you know, it is started from QThreadPool.
Qt Code:
  1. class Worker : public QObject, public QRunnable
  2. {
  3. Q_OBJECT
  4. public:
  5. Worker();
  6.  
  7. protected:
  8. virtual void run();
  9. };
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. void Worker::run()
  2. {
  3. Sender sender;
  4. sender.send({"text1", "text2"});
  5. }
To copy to clipboard, switch view to plain text mode 

The sender.send() method:
Qt Code:
  1. void DataSender::send(const QList<QString>& data)
  2. {
  3. QUrl serviceUrl = QUrl(given_ip_addr);
  4. QNetworkRequest request(serviceUrl);
  5. QJsonObject json;
  6. for (auto& line : data)
  7. json.insert("data", line);
  8. QJsonDocument jsonDoc(json);
  9. QByteArray jsonData= jsonDoc.toJson();
  10. request.setHeader(QNetworkRequest::ContentTypeHeader,"application/json");
  11. request.setHeader(QNetworkRequest::ContentLengthHeader,QByteArray::number(jsonData.size()));
  12. QNetworkReply *reply = _networkMgr.post(request, jsonData);
  13. }
To copy to clipboard, switch view to plain text mode 

Generally, the problem is: there is no any messages send to the endpoint given_ip_addr. No messages are received by the endpoint.

I think, the problem is in the running QNetworkAccessManager in the new thread, because I have tested another solution - I ran exactly the same send method in MAIN thread of whole application and there weren't any problems.

Do you have any idea? Unfortunately, I did not find anything in google about such problem.

Best Regards!