Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for WebAssembly
  4. Errors usiong QNetworkInterface class in WebAssembly
QtWS25 Last Chance

Errors usiong QNetworkInterface class in WebAssembly

Scheduled Pinned Locked Moved Solved Qt for WebAssembly
5 Posts 2 Posters 309 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.
  • L Offline
    L Offline
    leonidh
    wrote on 28 Dec 2024, 22:19 last edited by
    #1

    Hello,

    I am new to WebAssembly (and Qt in general). I am attempting to create a remote UI for a utility on a Linux computer. A browser was selected as a simple solution for remote UI. Data sharing between the Remote UI program and server uses a UDP socket. The Remote UI program, when compiled by Mingw_64, works as intended. However, as soon as I switch to compile for WebAssembly, I get errors for the QNetworkInterface Class.

    error: allocation of incomplete type 'QNetworkInterface'
    11 | QNetworkInterface * testAdapter = new QNetworkInterface();
    | ^~~~~~~~~~~~~~~~~
    C:\Qt\6.8.1\wasm_multithread\include\QtNetwork\qudpsocket.h:17:7: note: forward declaration of 'QNetworkInterface'
    17 | class QNetworkInterface;

    An interesting point is that when compiled under the Mingw_64, the line in question uses qnetworkInterface.h file located in C:\Qt\6.8.1\mingw_64\include\QtNetwork. However, when compiled under WebAssembly, the same line fails with the call to qudpsocket.h file that is located C:\Qt\6.8.1\wasm_multithread\include, even though the qnetworkinterface.h file is located in the same directory.

    Any thoughts on why this is happening?

    Thank you for any help.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      Mesrine
      wrote on 29 Dec 2024, 16:12 last edited by Mesrine
      #4

      Now checking the documentation of QNetworkInterface, It seems to me this class should not be available in WASM. Because of the web sandbox where the program is running the application can not have access to network interfaces.
      And as explained here it is not among the supported ones.

      L 1 Reply Last reply 29 Dec 2024, 17:08
      0
      • M Offline
        M Offline
        Mesrine
        wrote on 29 Dec 2024, 08:42 last edited by
        #2

        Have you explicitly included the respective header #include <QNetworkInterface> in the file with this initialization QNetworkInterface * testAdapter = new QNetworkInterface();?

        L 1 Reply Last reply 29 Dec 2024, 15:16
        0
        • M Mesrine
          29 Dec 2024, 08:42

          Have you explicitly included the respective header #include <QNetworkInterface> in the file with this initialization QNetworkInterface * testAdapter = new QNetworkInterface();?

          L Offline
          L Offline
          leonidh
          wrote on 29 Dec 2024, 15:16 last edited by leonidh
          #3

          @Mesrine Thank you for your reply.
          Yes, of course. I included headers QNetworkInterface, QUdpSocket and QNetworkDiagram in the class header file.

          1 Reply Last reply
          0
          • M Offline
            M Offline
            Mesrine
            wrote on 29 Dec 2024, 16:12 last edited by Mesrine
            #4

            Now checking the documentation of QNetworkInterface, It seems to me this class should not be available in WASM. Because of the web sandbox where the program is running the application can not have access to network interfaces.
            And as explained here it is not among the supported ones.

            L 1 Reply Last reply 29 Dec 2024, 17:08
            0
            • M Mesrine
              29 Dec 2024, 16:12

              Now checking the documentation of QNetworkInterface, It seems to me this class should not be available in WASM. Because of the web sandbox where the program is running the application can not have access to network interfaces.
              And as explained here it is not among the supported ones.

              L Offline
              L Offline
              leonidh
              wrote on 29 Dec 2024, 17:08 last edited by
              #5

              @Mesrine Thank you again for your quick reply.

              I was so focused on the UI portion, that I didn't read the Networking section of the documentation properly. I need to investigate an alternative way to share data between the utility and the Remote UI.

              Thanks again for your help.

              1 Reply Last reply
              0
              • L leonidh has marked this topic as solved on 29 Dec 2024, 17:08

              5/5

              29 Dec 2024, 17:08

              • Login

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