Server Development Tutorial

Step 2 - Creating an Address Space

In this section you will create your own address within the server, by defining the Node/folder structure, the access-rights for each node, and how the data for each node will be provided.

This step is a continuation of Step 1 - New Project.

  1. Within your new project you will double-click the file ReferenceNodeManager.cs.

  2. By default, the source code is opened with all regions collapsed by default, expand the INodeManager Members region.

  3. Locate the CreateAddressSpace method and expand it to view the source code.
    This particular function is quite large and therefore contains sub-regions within it, to make the code easier to navigate.

  4. Using the code that you can see, simply modify the address to meet your needs.

Keep in mind that the address space is created during application startup, but you can modify it at any time!

Creating Your Own Node Structure

We will create one new node, in one new folder that we will create below the root node as shown here:

Root -> MyFolder -> MyNode

  1. Go to line #135 which should be an empty line just above "FolderState folder1 = " and create a new folder definition:
    FolderState myFolder = CreateFolder( root, "/MyFolder", "MyFolder" );

  2. We will now create our Node. But, there are MANY different types of node that you can create. We will create a simple "Variable" type node, although you are encouraged to explore (within the code) the other types that are available:
    variables.Add(CreateVariable(myFolder,"/MyFolder/MyNode","MyNode",BuiltInType.Int32,ValueRanks.Scalar));

  3. You can change the name and data-type in the above line of code. Simply navigate to the "CreateVariable" function for details on how it creates and defines the node.

You have just seen how to create a simple folder and node. Next, we will look at how you can update the values of the nodes within your address space. Go to Step 3 - Reading Values.