Solved Qt5 QTcpSocket, Windows 10, connectToHost waits infinitely if destination no available
-
I've noticed on Windows 10 that (in most occasions) when a connection drops and the destination server is not ready when I retry the second time, then connectToHost would wait infinitely, does not return timeout error.
Any idea how to solve this?
-
@gkavrecic
Is anything in https://forum.qt.io/topic/97149/can-i-set-the-timeout-value-on-qabstractsocket-connecttohost relevant to you? -
@gkavrecic
Is anything in https://forum.qt.io/topic/97149/can-i-set-the-timeout-value-on-qabstractsocket-connecttohost relevant to you? -
@JonB
Thanks for the hint.
As the QNetworkConfig is marked obsolete I'll go with the timer approach.
Altough think the QSocket object shall have this setting. Or even the connectToHost shall have an optional parameter with timeout. -
@JonB
I've applied the proposed approach and works as expected.