예제 #1
0
 /// <summary>
 /// 连接OPC
 /// </summary>
 public bool ConnectOpc(ref string errMsg)
 {
     try
     {
         opcClient = new OpcClient();
         var result = opcClient.ConnectOpcServer(serverIp, serverName, ref errMsg);
         if (result)
         {
             opcClient.DataChanged += OpcClient_DataChanged;
         }
         return(result);
     }
     catch (Exception ex)
     {
         errMsg = ex.Message;
         return(false);
     }
 }