title: Understanding free OPC/UA code in python
body: <p>I am working on <code>OPCUA</code> in python. I am using <a href="https://github.com/FreeOpcUa/python-opcua" rel="noreferrer">freeopc</a>. I have used their server_minimal &amp; client_minimal example and it is running fine. I am having some issues understanding the code. As far as I know the OPCUA stack, it has address space which is like a collection of all the nodes. These nodes then further contains objects and these objects have variable from where we can read write data. Please correct me if I am wrong.</p>
  
  <pre><code>---------------------------------
           Address space
  ---------------------------------
     |                    |
     |                    |
     V                    V
    Node1               Node2
     |
     Object1
      |
      Var1, Var2
  </code></pre>
  
  <p>So on the server side I want to know what is namespace </p>
  
  <pre><code># setup our own namespace, not really necessary but should as spec
  uri = "http://examples.freeopcua.github.io"
  idx = server.register_namespace(uri)
  </code></pre>
  
  <p>What is the namespace used for.? What to put inside uri.?</p>
  
  <p>On client side, I want to know:</p>
  
  <p>After connecting to server, we are doing:</p>
  
  <pre><code>    # Client has a few methods to get proxy to UA nodes that should always be in address space such as Root or Objects
      root = client.get_root_node()
      print("Objects node is: ", root)
  </code></pre>
  
  <p>What does <code>get_root_node()</code> means. Is it like we are connecting to address space of server where all the nodes are defined.?</p>
  
  <pre><code>    # Node objects have methods to read and write node attributes as well as browse or populate address space
      print("Children of root are: ", root.get_children())
  </code></pre>
  
  <p><code>root.get_children()</code>-- Does this means getting the objects of the nodes.?</p>
  
  <pre><code>    # Now getting a variable node using its browse path
      myvar = root.get_child(["0:Objects", "2:MyObject", "2:MyVariable"])
      obj = root.get_child(["0:Objects", "2:MyObject"])
  </code></pre>
  
  <p><code>root.get_child</code> what does it means.?</p>
  
  <p>Client output:</p>
  
  <pre><code> ('Objects node is: ', Node(TwoByteNodeId(i=84)))
   ('Children of root are: ', [Node(NumericNodeId(i=85)), Node(NumericNodeId(i=86)), Node(NumericNodeId(i=87))])
  </code></pre>
  
  <p>Above code is taken from <a href="https://github.com/FreeOpcUa/python-opcua/blob/master/examples/server-minimal.py" rel="noreferrer">server_minimal.py</a> <a href="https://github.com/FreeOpcUa/python-opcua/blob/master/examples/client-minimal.py" rel="noreferrer">client_minimal.py</a></p>
  
  <p>Can anyone please explain these. I tried reading their docs but this is not mentioned there.</p>
  
  <p>Thanks.</p>