Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Strange behavior with TCP/IP and WSAGetLastError with command app and GUI app
giesbert last edited by
we have two applications (one command runner and one GUI runner) that share code from a library. It's a UnitTest environment for our product. The same code gives different behavior on GUI and command:
We have a function foo which is executed in main thread (we only use main thread:
long lErr = WSAGetLastError();
if(lErr == WSAEHOSTUNREACH)
If we run this code from the command runner, it is ok and the condition is true, if we run it from GUI runner it is false. same code, theoretically no other interaction between.
The only difference between the runners is, that in GUI rzunner, a window is in the background which displays the results after each test point (which is done after the if) and in command ruinner, there is no UI, it reports to the cout.
Any idea, where the reset of the error code might come from? I'm not sure, whether it is really a Qt issue, butr it happens inside the Qt UI, whyever.....
The environment is Windows XP and Windows Server 2008, Qt 4.6.3 and MSVS 2008 SP1.