<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- remoteobjects-nodes.qdoc --> <title>Qt Remote Objects Nodes | Qt Remote Objects 5.9</title> <link rel="stylesheet" type="text/css" href="style/offline-simple.css" /> <script type="text/javascript"> document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css"); // loading style sheet breaks anchors that were jumped to before // so force jumping to anchor again setTimeout(function() { var anchor = location.hash; // need to jump to different anchor first (e.g. none) location.hash = "#"; setTimeout(function() { location.hash = anchor; }, 0); }, 0); </script> </head> <body> <div class="header" id="qtdocheader"> <div class="main"> <div class="main-rounded"> <div class="navigationbar"> <table><tr> <td >Qt 5.9</td><td ><a href="qtremoteobjects-index.html">Qt Remote Objects</a></td><td >Qt Remote Objects Nodes</td></tr></table><table class="buildversion"><tr> <td id="buildversion" width="100%" align="right">Qt 5.9.4 Reference Documentation</td> </tr></table> </div> </div> <div class="content"> <div class="line"> <div class="content mainContent"> <div class="sidebar"> <div class="toc"> <h3><a name="toc">Contents</a></h3> <ul> <li class="level1"><a href="#nodes">Nodes</a></li> <li class="level1"><a href="#connecting-nodes-using-qtro-urls">Connecting Nodes using QtRO URLs</a></li> </ul> </div> <div class="sidebar-content" id="sidebar-content"></div></div> <h1 class="title">Qt Remote Objects Nodes</h1> <span class="subtitle"></span> <!-- $$$qtremoteobjects-node.html-description --> <div class="descr"> <a name="details"></a> <a name="nodes"></a> <h2 id="nodes">Nodes</h2> <p>QRemoteObjectNodes (let's shorten the name to Node for now) are what enables the passing of information between processes. All of the QtRO functionality is enabled by a small number of distinct packets passing the necessary data between nodes.</p> <p>Each process that participates in QtRO's IPC will instantiate a Node-based type (<a href="qremoteobjectnode.html">QRemoteObjectNode</a>, <a href="qremoteobjecthost.html">QRemoteObjectHost</a>, or <a href="qremoteobjectregistryhost.html">QRemoteObjectRegistryHost</a>). The latter types of Nodes provide additional functionality. Both <a href="qremoteobjecthost.html">QRemoteObjectHost</a> and <a href="qremoteobjectregistryhost.html">QRemoteObjectRegistryHost</a> support the <a href="qremoteobjecthostbase.html#enableRemoting">enableRemoting()</a> (and the corresponding <a href="qremoteobjecthostbase.html#disableRemoting">disableRemoting()</a>) methods, which are the key methods to expose <a href="qtremoteobjects-source.html#source">Source</a> objects to the network. In order to use the <a href="qtremoteobjects-registry.html#registry">Registry</a> functionality, there should be one <a href="qremoteobjectregistryhost.html">QRemoteObjectRegistryHost</a> on the network. All other nodes can then pass the RegistryHost's URL to the Node's <i>registryAddress</i> constructor parameter, or pass the URL to the <a href="qremoteobjectnode.html#registryUrl-prop">setRegistryUrl()</a> method.</p> <p>QtRO works as a peer-to-peer network. That is, in order to <a href="qremoteobjectnode.html#acquire">acquire()</a> a valid <a href="qtremoteobjects-replica.html#replica">Replica</a>, the <a href="qtremoteobjects-replica.html#replica">Replica</a> node needs a connection to the node that hosts its <a href="qtremoteobjects-source.html#source">Source</a>. A host node is a node that allows other nodes to connect to it, which is accomplished by giving hosts unique addresses (the address is provided to the <a href="qremoteobjecthost.html">QRemoteObjectHost</a> constructor or set by the setHostUrl method). The node that a <a href="qtremoteobjects-replica.html#replica">Replica</a> is requested from must establish the connection to the host node in order to initialize the <a href="qtremoteobjects-replica.html#replica">Replica</a> and keep it up to date.</p> <a name="connecting-nodes-using-qtro-urls"></a> <h2 id="connecting-nodes-using-qtro-urls">Connecting Nodes using QtRO URLs</h2> <p>Host Nodes use custom URLs to simplify connections. While the list will likely be extended, QtRO currently supports two types of connections. A "tcp" connection (using the standard tcp/ip protocol) supports connections between devices as well as between processes on the same device. The 2nd option is a "local" connection - which can have less overhead, depending on the underlying OS features - but does not support connectivity between devices.</p> <p>When using a local connection, a unique name must be used. For tcp connections, a unique address and port number combination much be used.</p> <p>There is currently no <a href="http://www.zeroconf.org/">zeroconf</a> facility included in QtRO. All processes or devices must therefore know beforehand how to connect to each other. A <a href="qremoteobjectregistry.html">QRemoteObjectRegistry</a> (see below) can be used to simplify the connection process for a network with multiple Host Nodes.</p> <p>Connection types are summarized in the following table.</p> <div class="table"><table class="generic" width="90%"> <thead><tr class="qt-style"><th >URL</th><th >Host Node</th><th >Connecting Node</th></tr></thead> <tr valign="top" class="odd"><td >QUrl("local:replica")</td><td >QLocalServer("replica")</td><td >QLocalSocket("replica")</td></tr> <tr valign="top" class="even"><td >QUrl("tcp://192.168.1.1:9999")</td><td >QTcpServer("192.168.1.1",9999)</td><td >QTcpSocket("192.168.1.1",9999)</td></tr> </table></div> <p>Nodes have a couple of <a href="qremoteobjecthostbase.html#enableRemoting">enableRemoting()</a> methods that are used to share objects on the network (this will produce an error if the Node is not a Host Node however). Other processes/devices that want to interact with a shared object use one of the <a href="qremoteobjectnode.html#acquire">node's acquire()</a> methods to instantiate a replica.</p> </div> <!-- @@@qtremoteobjects-node.html --> </div> </div> </div> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2017 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners.<br> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.<br> Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners. </p> </div> </body> </html>