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. Qt 5.4 QTcpSocket failure in WinRT with QNativeSocketEnginePrivate::nativeConnect:: Could not obtain connect action
QtWS25 Last Chance

Qt 5.4 QTcpSocket failure in WinRT with QNativeSocketEnginePrivate::nativeConnect:: Could not obtain connect action

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.1k Views
  • 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.
  • J Offline
    J Offline
    justinr1234
    wrote on last edited by
    #1
    • I'm attempting to recompile an existing Qt 5.3 project with the latest Qt 5.4 beta (http://download.qt-project.org/development_releases/qt/5.4/5.4.0-beta/qt-opensource-windows-x86-winrt-5.4.0-beta.exe).
    • My current program is running flawlessly on the following platforms: ios (ipad & iphone both), mac, linux, windows, android.
    • Main UI runs fine but I get the failure on trying to use QTcpSocket
    • I have not tried this on Qt 5.3. This is only Qt 5.4. I have never run my program on Qt 5.3.

    My code looks like this:
    @
    QTcpSocket->connectToHost(server, port, ReadWrite, IPv4Protocol);
    QTcpSocket->waitForConnected(30000);
    @

    The call to connectToHost, when running my project in debug mode on WinRT, has some debug output which looks fishy:
    HEAP[WinPCSQt.exe]: HEAP: Free Heap block 000000902D4DC260 modified at 000000902D4DC2C8 after it was freed
    qt.winrtrunner.app: QNativeSocketEnginePrivate::nativeConnect:: Could not obtain connect action
    QNativeSocketEnginePrivate::nativeConnect:: Could not obtain connect action
    qt.winrtrunner.app: QNativeSocketEnginePrivate::nativeConnect:: Could not obtain connect action
    QNativeSocketEnginePrivate::nativeConnect:: Could not obtain connect action

    Running without the debugger, compiled with Release Profile, I get this message from winrtrunner on start: qt.winrtrunner.app: Unable to bind socket. (Access is denied.)

    When I call waitForConnected I get an immediate return of false. Two conditions:

    • Running without the debugger, but compiled with the Debug Profile: error() returns 0
    • Running WITH the debugger, compiled in Debug Profile: error() returns -1

    What I have tried:

    • I have verified that the connection works perfectly on all other OSes (even at the exact same time as trying on WinRT).
    • I have verified that it runs perfectly on the SAME MACHINE as a regular Windows desktop app
    • I have disabled the Windows firewall completely for all network types (public & private)
    • I have modified my deployment information for QMAKE with no luck (see below the winrt { config). This also doesn't actually generate any capabilities in the appxmanifest.xml.
    • I have modified the AppxManifest.xml directly and added capabilities for "internetClientServer" and "privateNetworkClientServer" (see below)
    • I have verified I'm modifying the correct AppxManifest.xml ... if I try to run the app from QtCreator with a malformed file, it complains that the file is invalid

    WinRT info on app manifest and capbilities:

    • "How to set network capabilities (HTML)":http://msdn.microsoft.com/en-us/library/windows/apps/hh770532.aspx
    • "App capability declarations (Windows Runtime apps)":http://msdn.microsoft.com/en-us/library/windows/apps/hh464936.aspx
    • "How to specify capabilities in a package manifest":http://msdn.microsoft.com/en-us/library/windows/apps/br211477.aspx

    @
    winrt {
    winphone:equals(WINSDK_VER, 8.0) {
    WINRT_MANIFEST.capabilities += ID_CAP_NETWORKING
    } else {
    WINRT_MANIFEST.capabilities += internetClient
    }

    CONFIG += windeployqt
    

    }
    @

    @
    <Capabilities>
    <Capability Name="internetClientServer"></Capability>
    <Capability Name="privateNetworkClientServer"></Capability>
    </Capabilities>
    @

    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