Пример #1
0
 private static async Task ConnectAsync()
 {
     client = new OpcUaClient
     {
         UserIdentity = new UserIdentity(new AnonymousIdentityToken())
     };
     await client.ConnectServer("opc.tcp://localhost:62567");
 }
Пример #2
0
        private static async Task <OpcUaClient> ConnectAsync(string connectionStr)
        {
            var client = new OpcUaClient()
            {
                UserIdentity = new UserIdentity(new AnonymousIdentityToken())
            };
            await client.ConnectServer(connectionStr);

            return(client);
        }
Пример #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("OpcUa Client Start ...");
            OpcUaClient m_OpcUaClient = new OpcUaClient
            {
                UserIdentity = new UserIdentity(new AnonymousIdentityToken())
            };

            m_OpcUaClient.ConnectServer("opc.tcp://localhost:62567");

            m_OpcUaClient.AddSubscription("CPU_Usage", "ns=2;i=15014", SubCallback);
            m_OpcUaClient.AddSubscription("LogLine", "ns=2;i=15022", SubCallback);

            Console.WriteLine("Please enter any key to quit!");
            Console.ReadLine();
            m_OpcUaClient.Disconnect();
        }