예제 #1
0
파일: Program.cs 프로젝트: lulzzz/OpcUaDemo
 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();
        }