Skip to main content

Nodes

s.Nodes() It is a Lazy Load node accessor that allows you to access remote nodes just as you would local objects; at the same time, the Session previous set of methods Browse directly uses strings NodeId.

Subpage Redirect
  • For the node container entry point, see NodeCollection.
  • For single-node wrapping, please refer to Node.
  • For single-level browsing, please see Browse.
  • To continue reading, please see the next page. BrowseNext.
  • For information on ContinuationPoint [...], please refer to BrowseWithPaging.
  • For batch parsing of paths, please refer to TranslateBrowsePaths.
  • For high-frequency access acceleration, please refer to RegisterNodes.

Three Ways to Access Nodes​

#include <darra/opcua/client.hpp>

using namespace darra::opcua;

Session s("opc.tcp://localhost:4840");
s.Connect();

// Method 1: Direct string NodeId access (simplest, 1 read RPC)
auto dv1 = s.Read("ns=2;s=Temperature");

// Method 2: Indexer (like local objects, exploratory) — Each level [] is a single iteration Browse
auto dv2 = s.Nodes()["ns=2;s=Temperature"].Value();
auto t = s.Nodes().Server()["ServerStatus"]["CurrentTime"].Value();

// Method 3: Path Resolution — Once per Segment Browse
auto node = s.Resolve("/Objects/Server/ServerStatus/CurrentTime");
auto dv3 = node.Value();

All three methods are standard Read / Service Browse operations; the only difference isNumber of round trips triggered: Method 1 is the most efficient; Methods 2 and 3 send a message for each level traversed Browse, making them suitable for exploratory node selection. In production code, use NodeId Method 1 when the information is known.

Selection Guide​

ScenarioRecommendations
Known to be accurate NodeId (Production Code)Method 1: String
Standard ns=0 NodeMethod 2 + WellKnownNodes
Browse Tree / One-Time ScriptMethod 2: Indexer
Batch Initialization When There Are Multiple PathsTranslateBrowsePaths (Full path 1 time RPC)
Long-term operation with high-frequency accessRegisterNodes Accelerate

Next Step​