Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.5.0
-
None
-
Windows 10
Description
I'm following the first External QIODevices example but it's missing to demonstrate how the srcNode is being enabled.
I tried:
#include "rep_remoteobject_source.h" class RemoteObject : public RemoteObjectSource { Q_OBJECT //... } //... QTcpServer tcpServer; tcpServer.listen(QHostAddress(QStringLiteral("tcp://xxx.128.35.160")), 65214); QRemoteObjectHost srcNode; QObject::connect(&tcpServer, &QTcpServer::newConnection, &srcNode, [&] { srcNode.addHostSideConnection(tcpServer.nextPendingConnection()); }); RemoteObject remoteObject; bool ret = srcNode.enableRemoting(&remoteObject, "remoteObject"); qDebug() << "enableRemoting:" << ret;
But enableRemoting is returning false.
In the documentation of enableRemoting "Returns false if the current node is a client node"
And in the example there's a comment:
// Create the host node. We don't need a hostUrl unless we want to take// advantage of external schemas (see next example).
Without a hostUrl set in the srcNode, it's probably being threatened as a client.
What's wrong?