Siemens Industry Online Support
Siemens AG
Entry type: Application example Entry ID: 42014088, Entry date: 06/29/2018

Programming an OPC UA .NET Client with C# for the SIMATIC NET OPC UA Server

  • Entry
  • Associated product(s)
Using the SIMATIC NET OPC UA server as gateway, you can access your controllers via OPC UA. OPC UA enables inter-manufacturer communication as well as easy connection to the MES / ERP level.

To realize a data link between a controller and a PC system, standardized mechanisms are preferably used to ensure that such a data exchange remains independent of the used bus system or protocol or even manufacturer. OPC UA combines this functionality and additionally offers authentication and encrypted data transmission and advanced diagnostic information. In this example, the OPC UA Server is to be considered as an information server. The core task of this example is secure access to process data via the new OPC UA interface of the SIMATIC NET OPC Server.

The OPC UA Client in the PC station is realized at two levels of complexity. A client whose design is very simple (Simple OPC UA Client) shows you all basic functions and introduces you to OPC UA. A more complex client (OPC UA .NET Client) with a convenient user interface demonstrates professional OPC UA handling with reusable classes realized in .NET in the C# programming language.

The figure below shows the hardware configuration of this example:

Fig. 1

The following scenarios are explained in terms of software in both sample clients:

  • Logging on to, logging off from and authentication on the OPC UA Server
  • Browsing the namespace of variables
  • Reading, writing and monitoring variables
  • Reading and writing when using S7 block services
  • Using absolute and symbolic addressing
  • Easy error handling

The more complex OPC UA Client example additionally includes field-proven classes and controls in .NET, intended to facilitate programming of individual OPC UA Clients. For this purpose, the complex OPC UA .NET Client SDK methods are encapsulated in a client API that is easier to use.

Client user interfaces
Simple OPC UA Client user interface:

Fig. 2

Advanced OPC UA Client user interface:

Fig. 3

  Documentation of the example (3,1 MB)
 Registrierung notwendig  .NET sample client with and TIA project (V14) (8,6 MB) 

Further Information
The following documents additionally deal with OPC-Client programming:
Individual Signaling System Based on the SIMATIC NET OPC Alarm and Event Server 
OPC Communication via the SEND/RECEIVE Protocol with a Visual Basic .NET OPC Client 
Using the XML-DA Interface of the SIMATIC NET OPC Server with Visual Basic .NET
External Block Management with S7 Block Management Services of the SIMATIC NET OPC Server
Mass Data Acquisition with an OPC Client in C# Based on .NET
Individual Visualization with OPC Based on Microsoft® .NET and the Programming Language C#
Distributed Automation with the PC - The SIMATIC NET OPC Server as DP Slave
Controlling with the PC - The SIMATIC NET OPC Inproc Server as DP Master

Last change
Migration to STEP 7 V14, change to "UAClientHelperAPI"

Security information
In order to protect technical infrastructures, systems, machines and networks against cyber threats, it is necessary to implement – and continuously maintain – a holistic, state-of-the-art IT security concept. Siemens’ products and solutions constitute one element of such a concept. For more information about cyber security, please visit
Rate entry
no rating
Requests and feedback
What do you want to do?
Note: The feedback always relates to the current entry / product. Your message will be forwarded to our technical editors working in the Online Support. In a few days, you will receive a response if your feedback requires one. If we have no further questions, you will not hear from us.