QNetworkAcessManager Not work in release mode on different computers



  • I have a very strange problem I create an application that use QNetworkAcessManager to download an HTML page and get the data from this page I release my application to use it on my second laptop on the same wireless connection but it not works.
    on my computer, after releasing the app and use windeploy.exe to get all the dll file for this release exe I try to use it on my computer which has QT and developed on it it works fine and get the data in the file.
    the problem comes when I use it on another computer the app works but when I press the button to get the data it gets nothing just empty file
    so any help for this problem
    Update
    this the code which I use normal QNetworkAcessManager code to get HTML page data
    this code in the button to get the data

        manager->clearAccessCache();
        manager->clearConnectionCache();
        if (reply != nullptr)
            delete reply;
        reply = manager->get(QNetworkRequest(QUrl("https://normalpage.html")));
        connect(reply, SIGNAL(readyRead()), this, SLOT(readyRead()));
        connect(reply, SIGNAL(finished()), this, SLOT(Finish()));
    

    readyread

    void MainWindow::readyRead()
    {
        data.append(reply->readAll());
    }
    

    finish function I get the data of type QByteArray and use it to get the data from it the function is long
    I was having this problem for about two months but I was in hurry so I used libcurl with QProcess to get this HTML page data but I now I want to know what cause this problem
    update
    I use this code in my main to get all the Qt Warnings and errors to check what makes this problem

    #include "mainwindow.h"
    #include <QApplication>
    
    #include <QtGlobal>
    #include <stdio.h>
    #include <stdlib.h>
    
    void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
    {
        QByteArray localMsg = msg.toLocal8Bit();
        FILE *file;
        file = fopen("error.txt", "a");
        switch (type) {
        case QtDebugMsg:
            fprintf(file, "Debug: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
            break;
        case QtInfoMsg:
            fprintf(file, "Info: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
            break;
        case QtWarningMsg:
            fprintf(file, "Warning: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
            break;
        case QtCriticalMsg:
            fprintf(file, "Critical: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
            break;
        case QtFatalMsg:
            fprintf(file, "Fatal: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
            abort();
        }
    }
    
    int main(int argc, char *argv[])
    {
        qInstallMessageHandler(myMessageOutput);
        QApplication a(argc, argv);
        MainWindow w;
        w.show();
    
        return a.exec();
    }
    

    the error file on the not working computer gives me this file

    Warning: QSslSocket: cannot call unresolved function ERR_get_error ((null):0, (null))
    )
    ))
    Warning: QSslSocket: cannot call unresolved function SSLv23_client_method ((null):0, (null))
    Warning: QSslSocket: cannot call unresolved function SSL_CTX_new ((null):0, (null))
    Warning: QSslSocket: cannot call unresolved function SSL_library_init ((null):0, (null))
    Warning: QSslSocket: cannot call unresolved function ERR_get_error ((null):0, (null))
    Warning: QSslSocket: cannot call unresolved function ERR_get_error ((null):0, (null))
    Warning: QSslSocket: cannot call unresolved function SSLv23_client_method ((null):0, (null))
    Warning: QSslSocket: cannot call unresolved function SSL_CTX_new ((null):0, (null))
    Warning: QSslSocket: cannot call unresolved function SSL_library_init ((null):0, (null))
    Warning: QSslSocket: cannot call unresolved function ERR_get_error ((null):0, (null))
    Warning: QSslSocket: cannot call unresolved function ERR_get_error ((null):0, (null))
    

    but on my working computer it gives me this

    Warning: QSslSocket: cannot resolve SSL_set_alpn_protos ((null):0, (null))
    Warning: QSslSocket: cannot resolve SSL_CTX_set_alpn_select_cb ((null):0, (null))
    Warning: QSslSocket: cannot resolve SSL_get0_alpn_selected ((null):0, (null))
    Warning: QSslSocket: cannot resolve SSL_set_alpn_protos ((null):0, (null))
    Warning: QSslSocket: cannot resolve SSL_CTX_set_alpn_select_cb ((null):0, (null))
    Warning: QSslSocket: cannot resolve SSL_get0_alpn_selected ((null):0, (null))
    

    if anyone can check these warnings and see if it cause the problem as I don't know
    thanks in advance


  • Moderators

    Hi! Maybe it's the firewall or something similar.



  • they are Turned off on both computers



  • @AmrCoder said in QNetworkAcessManager Not work in release mode on different computers:

    QUrl("https

    Did you remember to deploy OpenSSL?



  • @VRonin no, and how can I do this when I release an app in Qt i only use windeployqt.exe to take all needed DLLs for the app to work if there another method to make qnetworkacessmanager work tell me how



  • @VRonin I copied this two files libeay32 and ssleay32 dlls to the folder and it not work too



  • Could you change the code so it goes on a http (i.e. not https) page and see if it works there?



  • @VRonin this time when I tried HTTP it not worked even on my computer



  • You didn't mention which platform this was on, but from one of your replies, I take it to be windows.
    As well, which version of Qt, and did you compile it yourself?



  • Iam using windows 10
    Qt 5.9.1
    yes I compile it my self the computer which has Qt the QNetworkAcessManager Give me an output as I mention and it works in release mode too when I release the app and put all dlls using winddeploy.exe
    and use the app without QT it works but when I try on another computer it didn't work or give me any data


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.