Reference
Sample applications
Fully runnable clients and servers with the OPC UA .NET SDK in C# and VB.NET, filterable by kind and language, with links to GitHub.
Reference
Sample applications
The sample applications in the opcuanet-samples repository on GitHub are complete programs that you can clone, run, and use as a starting point for your own applications. Most clients have a matching server in the same area. In that case, start the server first and then the client.
To run a sample, for example the client Basic/Client:
git clone https://github.com/Traeger-GmbH/opcuanet-samples.git
cd opcuanet-samples
dotnet run --project cs/Basic/Server -f net8.0
dotnet run --project cs/Basic/Client -f net8.0Run the server and the client in two separate consoles. The samples use the SDK in evaluation mode, that is, without a license key.
Basics
- Client
ClientThis sample demonstrates how to implement a primitive OPC UA client.
- Server
ServerThis sample demonstrates how to implement a primitive OPC UA server.
- Client
Client.AEThis sample demonstrates how to perform handling of Alarm + Events (AE) on the nodes provided by the OPC UA server.
- Server
Server.AEThis sample demonstrates how to setup an OPC UA server to provide AE to its nodes provided.
- Client
Client.AuthenticationThis sample demonstrates how to authenticate at an OPC UA server using user name and password.
- Server
Server.AuthenticationThis sample demonstrates how to setup an OPC UA server with a UserName policy using the UserName ACL for custom user name and password authentication.
- Client
Client.BrowsingThis sample demonstrates how to browse nodes and their attributes provided by the OPC UA server.
- Client
Client.DataTypesThis sample demonstrates how to consume structured data types defined and used by the OPC UA server.
- Server
Server.DataTypesThis sample demonstrates how to setup an OPC UA server to provide nodes with custom data types.
- Server
Server.DataTypes.ComplexThis sample demonstrates how to setup an OPC UA server to provide nodes with custom data types which are supplied using subtrees there appropriate.
- Client
Client.EventTypesThis sample demonstrates how to subscribe to events of a custom event type and how to access their structured event data through an own event class.
- Server
Server.EventTypesThis sample demonstrates how to setup an OPC UA server to provide a custom event type defined in a nodeset. Its events carry structured data and are raised when a client calls the StartJob method.
- Client
Client.HDAThis sample demonstrates how to perform history data access (HDA) on the data provided by the OPC UA server.
- Server
Server.HDAThis sample demonstrates how to setup an OPC UA server to provide HDA to its nodes provided.
- Server
Server.HDA.SqlThis sample demonstrates how to setup an OPC UA server to provide HDA via SQL to its nodes provided.
- Client
Client.MethodsThis sample demonstrates how to perform method calls using the OPC UA server provided method nodes.
- Server
Server.MethodsThis sample demonstrates how to setup an OPC UA server to provide method nodes.
- Server
Server.NodeTypesThis use case demonstrates how to import and implement custom node types using a nodeset.
Configuration
- Client
Client.ConfiguredViaCodeThis sample demonstrates how to configure an OPC UA client using in code configuration.
- Server
Server.ConfiguredViaCodeThis sample demonstrates how to configure an OPC UA server using in code configuration.
- Client
Client.ConfiguredViaXmlThis sample demonstrates how to configure an OPC UA client using a XML configuration file.
- Server
Server.ConfiguredViaXmlThis sample demonstrates how to configure an OPC UA server using a XML configuration file.
Node types
- Client
Client.AnalogItemNodeThis sample demonstrates how to access and work with nodes of the AnalogItemType.
- Server
Server.AnalogItemNodeThis sample demonstrates how to setup an OPC UA server to provide nodes of the AnalogItemType.
- Client
Client.DataTypeNodeThis sample demonstrates how to access and work with nodes which use custom data types.
- Server
Server.DataTypeNodeThis sample demonstrates how to setup an OPC UA server to provide DataTypeNode nodes.
- Client
Client.MethodNodeThis sample demonstrates how to access and work with method nodes.
- Server
Server.MethodNodeThis sample demonstrates how to setup an OPC UA server to provide MethodNode nodes.
Subscriptions
- Client
Client.BulkChangesThis sample demonstrates how to subscribe to a large number of nodes and process their data changes in a separate consumer thread.
- Server
Server.BulkChangesThis sample demonstrates how to setup an OPC UA server that changes the values of a large number of nodes at once in a fixed interval.
- Client
Client.BulkChanges.HiResThis sample demonstrates how to receive data changes of a large number of nodes with minimal latency, using a publishing interval of zero and a callback for each data set.
- Server
Server.BulkChanges.HiResThis sample demonstrates how to configure an OPC UA server for high resolution publishing, to deliver changes of a large number of nodes in intervals of a few milliseconds.
- Client
Client.HandshakeChangesThis sample demonstrates how a client reads a block of data as soon as the server signals it as available and confirms its processing through a handshake node.
- Server
Server.HandshakeChangesThis sample demonstrates how to setup an OPC UA server that provides blocks of data using a handshake: it signals new data and waits until a client confirms their processing.
Scenarios
- App
App.LicenseUsageThis sample demonstrates how to apply the license keys of the SDK and how to protect them by string encryption when the application is obfuscated, here using Eazfuscator.NET.
- Client
Client.BlazorThis sample demonstrates how to connect to an OPC UA server and read node values from a Blazor Server application.
- Client
Client.ClientAddedNodesWithHistoryThis use case demonstrates how a client adds a variable node with history access to the server and writes values that the server records as history.
- Server
Server.ClientAddedNodesWithHistoryThis use case implementes the necessary logic required to support nodes which are added through a client application which wants the server to enable historical data.
- Server
Server.CustomFileThis use case represents in which way the IOpcFileInfo interface can be used to implement "custom file sources" for a OpcFileNode.
- Client
Client.DynamicNamespacesThis use case demonstrates how a client addresses nodes by namespace URI instead of namespace index and renews its subscriptions after each reconnect, so it copes with namespaces that change on the server.
- Server
Server.DynamicNamespacesThis use case demonstrates how to provide each namespace through its own node manager and how to restart the server with a different selection of node managers.
- Server
Server.DynamicNodesThis use case realizes dynamic nodes which are created on-demand by the server depending on the underlying system needs.
- Client
Client.GenericEventsThis use case demonstrates how to receive events of a custom event type without an own class for its fields, using a generic event class that exposes all selected event fields.
- Server
Server.LightweightEventsThis use case demonstrates in which way a server can "re-use" a single event node to represent events from different event sources without to define for each source another event node.
- Client
Client.LocalizationThis use case demonstrates how a client requests localized display names and descriptions by specifying its preferred locales.
- Server
Server.LocalizationThis use case demonstrates how to provide display names and descriptions of nodes in several languages using the globalization resources of the server.
- Server
Server.NodeAccessThis use case realizes restricted node access using built-in ACL functionality And subclassing for user dependent node metadata.
- Client
Client.NodeExplorerThis sample demonstrates how to browse the address space of an OPC UA server and show it as a tree in a Windows Forms application.
- Server
Server.NodeSet.PackMLThis use case demonstrates how to import and implement an alarm from a nodeset using the companion specification from PackML.
- Server
Server.NodeSet.Umati.LegacyThis use case demonstrates how to import and implement an alarm from a nodeset using the companion specification from UMATI.
- Server
Server.NodeSet.Umati.MachineToolThis use case demonstrates how to import and implement an alarm from a nodeset using the companion specifications from UMATI: In this case 'MachineTool'.
- Client
Client.PackMLThis use case demonstrates how to call a method of the PackML companion specification with structured arguments, using data types generated from the PackML nodeset.
- Server
Server.PlaygroundThis use case realizes a server which offers different kinds of nodes to easily test client applications against different possible use cases.
- Client
Client.RecursiveSubscriptionThis use case demonstrates how a client adds job nodes below a monitored node and receives the events the server raises for each added node.
- Server
Server.RecursiveSubscriptionThis use case represents in which way a server can monitor newly added nodes, work with them and notify clients about changes on these nodes.
- Client
Client.SignalRThis use case demonstrates how to forward data changes of OPC UA nodes to a web browser using an ASP.NET Core SignalR hub.
- Server
Server.SignalRThis use case demonstrates how to setup an OPC UA server whose node values change periodically. It provides the nodes that the Client.SignalR sample forwards to the web browser.
- Server
Server.SimaticNodesThis use case demonstrates how to define a custom factory for node identifiers to define / use node identifiers using the "SIEMENS SIMATIC" style of dot separated and quoted node names to construct the node identifier of a node.
- Server
Server.SimaticNodeSetThis use case demonstrates how to setup an OPC UA server that imports the nodeset of a SIMATIC S7-1500 controller and identifies itself like the server of the controller, e.g. to test clients without the hardware.
- Client
Client.StateMachineThis use case demonstrates how a client monitors the current state of a state machine provided by the server.
- Server
Server.StateMachineThis use case demonstrates how to implement a finite state machine node with custom states and how the server changes its state.
- Client
Client.TemperatureThis sample demonstrates how to connect to an OPC UA server and read the value of a node once per second.
- Server
Server.TemperatureThis sample demonstrates how to setup an OPC UA server that provides a temperature node and updates its value once per second.
- Client
Client.Umati.LegacyThis use case demonstrates how to subscribe to the alarms of a machine tool according to the legacy umati information model and read their specific fields.
- Client
Client.Umati.MachineToolThis use case demonstrates how to receive and confirm alerts of a machine tool according to the OPC UA companion specification for machine tools (umati).
- Server
Server.UserIdentitiesThis use case demonstrates how generic user identities could be implemented using built-in ACL functionality and how subclassing can be used to define the generic user identities.
Platforms
- Client
Client.UwpThis sample demonstrates how to implement a simple OPC UA client in an UWP Application.
- Client
Client.WpfThis sample demonstrates how to use the OPC UA client in a WPF application to subscribe to a node and show its value.

