我有一个非常奇怪的问题我创建了一个使用 QNetworkAcessManager 下载 HTML 页面并从此页面获取数据的应用程序我发布了我的应用程序以在同一无线连接上的第二台笔记本电脑上使用它,但它不起作用。
在我的计算机上,在发布应用程序并使用 windeploy.exe 获取此版本 exe 的所有 dll 文件后,我尝试在具有 QT 并在其上开发的计算机上使用它,它工作正常并获取文件中的数据。
当我在另一台计算机上使用它时,问题就来了按钮中的代码以获取数据
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()));
准备阅读
void MainWindow::readyRead()
{
data.append(reply->readAll());
}
完成函数我得到QByteArray类型的数据并用它来从中获取数据函数很长
我遇到这个问题大约两个月但我很着急所以我使用libcurl和QProcess来获取这个HTML页面数据但是我现在我想知道导致此问题
更新
的原因
我使用 main.cpp 中的代码来获取文件中的所有 Qt 警告和错误,正如 Macias 的评论中提到的那样,我将它放入我使用的文件中附加到文件中所以我可以得到它带来的所有错误,如果有人可以检查这些警告并查看它是否导致问题,我会从 QSslSocket 收到一些警告,因为我不知道
错误文件
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))
但是在工作计算机中我收到了这个警告
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))
当我在文件夹可执行文件中添加新的 dll 文件时
更新它给了我这个警告
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))
将回复连接到错误信号
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(Error(QNetworkReply::NetworkError)));
插槽在这里
void MainWindow::Error(QNetworkReply::NetworkError Myerror)
{
qDebug() << "QNetworkReply::NetworkError = " << Myerror;
}
这是我在连接错误信号和属性后得到的
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))
Debug: QNetworkReply::NetworkError = QNetworkReply::NetworkError(UnknownNetworkError) ((null):0, (null))
Debug: Attribute in finish slot = QVariant(Invalid) ((null):0, (null))
当我将三个 dll 文件添加到我的计算机上的发布文件夹时,我在没有它们的情况下工作的应用程序
当我转到 C:\AppServ\Apache24\bin 的路径并复制这个 dll(libeay32.dll 和 ssleay32 .dll)从这个文件夹而不是我从dll网站下载的其他文件夹,它终于可以工作了,但是appchace文件夹和从网站下载的有什么区别?
提前致谢