Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Strange behavior with TCP/IP and WSAGetLastError with command app and GUI app
Forum Updated to NodeBB v4.3 + New Features

Strange behavior with TCP/IP and WSAGetLastError with command app and GUI app

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    giesbert
    wrote on last edited by
    #1

    Hi,

    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:

    @
    foo()
    {
    ...
    WSASetLastError(WSAEHOSTUNREACH);
    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.

    Nokia Certified Qt Specialist.
    Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved