The project wizard creates sample code according the options selected.
The samples are provided in C# and Visual Basic with the Visual Studio project and are functional servers.
To debug the server the plug-in has to be compiled in 'Debug' mode. The Start Application is the generic server DANSrv.exe. The start application directory may need to changed in the project configuration because Visual Studio stores an absolute path in the project.
Application | Description |
Wizard generated Code
|
In the new project Wizard Dialog sample code can be requested. This sample code shows how: with dynamic address space handling enabled with virtual address space browsing enabled |
Simple | This is a simple server with a few items, statically defined within the code. A simulation thread increments the item values and updates the server cache. Write calls write the item value into the simulation buffer, forcing the incrementing to continue from the written value. |
Properties | This sample works as the 'Simple' sample and additionally defines an handles custom item properties. |
Dynamic | This sample is very similar to the 'Properties' sample but implements a dynamic item address space. At startup no items are defined in the generic server. All items are added dynamically when they are first accessed by a client. The browse mode is set to virtual and the client browse calls are handled in this sample. The return the items that could be added to the server cache. For the client this handling is invisible. It appears identical to the 'Properties' sample. The DANSrv Professional Edition is required because the Standard Edition does not support virtual browsing. |
ConfigBuilder | This sample loads the item configuration from the file CfgSample.xml and creates the defined items at startup. The XML file can be modified with the ConfigBuilder application. The new configuration used when the server is restarted. No compilation is required. The sample does embed the XML file to show this possibility. To use the embedded file the sample has to be modified to use the LoadEmbedded() method in place of LoadFromExeDir(). The method call is in the code as comment. |
20kItems | This sample defines 20000 items at startup and updates the first 1000 items every 100ms. It should give an impression of the performance and can be used as the base for a custom benchmark application. On a 2GHz Pentium the startup takes about 2 seconds and the CPU load is around 6%. |
SerialDevice | This sample uses a serial COM port for device communication. A simple .Net stream class for serial IO is included. For tests a Device simulator console application is provided. Connect the COM1 ports of two computer with a null modem cable and start the DeviceSimulator on one computer and the OPC server on the other. At startup the DeviceSimulator sends a line with item names and the server creates these items in it's address space. The DeviceSimulator then periodically increments the item values and sends lines with the values of all items. The server customization reads these lines and updates the server cache. Items written by a client are sent to the DeviceSimulator, which displays them. |
TCPDevice |
This sample uses a TCP socket on port 6500 for device communication. For tests a Device simulator console application is provided. |
StockQuotes |
This sample application shows how a server can be implemented to handle a huge number of items. |