コード例 #1
0
        static TheOPCUAClient ConnectOPCClient(string opcAddress)
        {
            var client = TheOPCUAClient.CreateAndInitAsync(myContentService, opcAddress, new OPCUAParameters
            {
                AcceptInvalidCertificate   = true,
                AcceptUntrustedCertificate = true,
                DisableDomainCheck         = true,
                DisableSecurity            = true,
            }).Result;

            Assert.IsNotNull(client);
            var result = client.ConnectAsync().Result;

            Assert.IsTrue(String.IsNullOrEmpty(result), $"Error sending connect message to OPC UA Client plug-in: {result}");
            Assert.IsTrue(client.IsConnected, "OPC UA Client not connected after sending connect message");
            return(client);
        }