Unsolved waitForConnected() hangs my program !
-
Hello,
I have a major problem with the latest version of Qt (5.12.1)
A simple function like this blocks the program under Windows 10 and Android. However, nothing to report on Linux and macOS.
bool Internet::CheckConnection(QString server) { QTcpSocket socket; socket.setProxy(QNetworkProxy::NoProxy); socket.connectToHost(server, 80); // Renvoie false si pas connecté rerun socket.waitForConnected(2000); }
In addition, I see also important break times with code like that:
reply3 = manager3->get(QNetworkRequest(url)); // Whenever more data is received from the network, // this readyRead() signal is emitted connect(reply3, SIGNAL(readyRead()), this, SLOT(httpReadyRead3())); // Also, downloadProgress() signal is emitted when data is received //connect(reply, SIGNAL(downloadProgress(qint64, qint64)), // this, SLOT(updateDownloadProgress(qint64, qint64))); // This signal is emitted when the reply has finished processing. // After this signal is emitted, // there will be no more updates to the reply's data or metadata. connect(reply3, SIGNAL(finished()), this, SLOT(httpDownloadFinished3())); thread3->start();
Nothing to report with Qt 5.12.0 and 5.11.3
What should I do?
Thanks !
Francky033
-
@Francky033 said in waitForConnected() hangs my program !:
bool Internet::CheckConnection(QString server)
{
QTcpSocket socket;
socket.setProxy(QNetworkProxy::NoProxy);
socket.connectToHost(server, 80);// Renvoie false si pas connecté
rerun socket.waitForConnected(2000);
}This will block 2 seconds when e.g. the server you want to reach is not available. And this function is somewhat useless - you're connecting to a socket but then deleting it as soon as it is connected...
-
Yes, this function only allows me to check, or not, the availability of a server. But the problem is that it doesn't answer after 5 minutes ! It's just an example of code....
But since these are secure connections, maybe it's a version problem with the ssleay32.dll and libeay32.dll files?Which versions should be used with Qt 5.12.1 ?
-
Maybe it is necessary to compile openssl in the version returned by QSslSocket::sslLibraryBuildVersionString and deliver the files libeay32.dll and ssleay32.dll with the executable?