Subscribe to node internally in this server

Questions regarding the use of the .NET SDK 2.0 for Server or Client development or integration into customer products ...

Moderator: uasdknet

Post Reply
YFR
Jr. Member
Jr. Member
Posts: 4
Joined: 02 Mar 2021, 16:00

Subscribe to node internally in this server

Post by YFR »

Hello,
Having developed a server with .NET SDK, I would like to subscribe to node internally in this server (monitoring change to node value made by the client).
I can see a similar topics in the forum, but for the C++ SDK counterpart ("How do I read or subscribe for data internally in the server" + "Modify a Variable value when another one (or more) change it").

Could you indicate, in .NET C# context, which functions to use, or some sample code, to provide a point to start from, please ?
Thank you.
Yves

User avatar
Support Team
Hero Member
Hero Member
Posts: 2666
Joined: 18 Mar 2011, 15:09

Re: Subscribe to node internally in this server

Post by Support Team »

the c# counterpart is the ServerInternalClient.

Code: Select all

                ServerInternalClient client = new ServerInternalClient(Server);
                InternalClientFastDataMonitoredItem item = new InternalClientFastDataMonitoredItem()
                {
                    NodeId = ObjectIds.Server,
                    AttributeId = Attributes.Value,
                    Callback = YourCallback
                };

                var list = new List<InternalClientFastDataMonitoredItem>();
                list.Add(item);
                var results = client.CreateDataMonitoredItems(Server.DefaultRequestContext, list);
The InternalClientFastDataMonitoredItem will deliver the changes immediately to the Callback, if need more options use the InternalClientFullDataMonitoredItem.
Best regards
Unified Automation Support Team

Post Reply