private void plcKeepAliveEventHandler(Opc.Ua.Client.Session sender, Opc.Ua.Client.KeepAliveEventArgs e) { try { // check for events from discarded sessions. if (!Object.ReferenceEquals(sender, opcSession)) { return; } // check for disconnected session. if (!ServiceResult.IsGood(e.Status)) { // try reconnecting using the existing session state opcSession.Reconnect(); } } catch (Exception ex) { log.Error(ex); } }