Errors usiong QNetworkInterface class in WebAssembly
-
wrote on 28 Dec 2024, 22:19 last edited by
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.
-
wrote on 29 Dec 2024, 16:12 last edited by Mesrine
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. -
wrote on 29 Dec 2024, 08:42 last edited by
Have you explicitly included the respective header
#include <QNetworkInterface>
in the file with this initializationQNetworkInterface * testAdapter = new QNetworkInterface();
? -
Have you explicitly included the respective header
#include <QNetworkInterface>
in the file with this initializationQNetworkInterface * testAdapter = new QNetworkInterface();
? -
wrote on 29 Dec 2024, 16:12 last edited by Mesrine
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. -
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.wrote on 29 Dec 2024, 17:08 last edited by@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.
-
2/5