|
|
@@ -113,7 +113,7 @@ namespace YSAI.Opc.ua.client
|
|
|
/// <summary>
|
|
|
/// 重连时间,多少秒与服务器进行重连一次
|
|
|
/// </summary>
|
|
|
- private int reconnectPeriod = 2;
|
|
|
+ private int reconnectPeriod = 10;
|
|
|
/// <summary>
|
|
|
/// 尝试重新连接到服务器
|
|
|
/// </summary>
|
|
|
@@ -870,9 +870,8 @@ namespace YSAI.Opc.ua.client
|
|
|
monitoredItem.DisplayName = item.AddressName; //被监控项的显示名称
|
|
|
monitoredItem.SamplingInterval = basics.SamplingInterval; //采样间隔
|
|
|
monitoredItem.MonitoringMode = MonitoringMode.Reporting; //采集模式
|
|
|
- monitoredItem.QueueSize = uint.MaxValue; //队列大小
|
|
|
- monitoredItem.DiscardOldest = true; //当队列满了是否丢弃早期数据
|
|
|
- monitoredItem.Handle = this; //本地监听地址
|
|
|
+ monitoredItem.QueueSize = 1; //队列大小
|
|
|
+ monitoredItem.DiscardOldest = false; //当队列满了是否丢弃早期数据
|
|
|
monitoredItem.Notification += delegate (MonitoredItem monitoredItem, MonitoredItemNotificationEventArgs e) { OnMonitoredItemNotification(monitoredItem, e, item); }; //重写事件添加一个参数
|
|
|
monitoredItems?.Add(monitoredItem); //添加至集合
|
|
|
}
|
|
|
@@ -890,12 +889,6 @@ namespace YSAI.Opc.ua.client
|
|
|
|
|
|
//在服务器上创建订阅并添加所有监视项
|
|
|
allSubscriptions[Tag].Create();
|
|
|
-
|
|
|
- // 将任何更改应用于订阅项
|
|
|
- allSubscriptions[Tag].ApplyChanges();
|
|
|
-
|
|
|
- //把此订阅添加到集合,方便后续移除订阅(当存在此键则更新值,不存在则添加)
|
|
|
- allSubscriptions?.AddOrUpdate(Tag, allSubscriptions[Tag], (k, v) => allSubscriptions[Tag]);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
@@ -928,9 +921,8 @@ namespace YSAI.Opc.ua.client
|
|
|
monitoredItem.DisplayName = item.AddressName; //被监控项的显示名称
|
|
|
monitoredItem.SamplingInterval = basics.SamplingInterval; //采样间隔
|
|
|
monitoredItem.MonitoringMode = MonitoringMode.Reporting; //采集模式
|
|
|
- monitoredItem.QueueSize = uint.MaxValue; //队列大小
|
|
|
- monitoredItem.DiscardOldest = true; //当队列满了是否丢弃早期数据
|
|
|
- monitoredItem.Handle = this; //本地监听地址
|
|
|
+ monitoredItem.QueueSize = 1; //队列大小
|
|
|
+ monitoredItem.DiscardOldest = false; //当队列满了是否丢弃早期数据
|
|
|
monitoredItem.Notification += delegate (MonitoredItem monitoredItem, MonitoredItemNotificationEventArgs e) { OnMonitoredItemNotification(monitoredItem, e, item); }; //重写事件添加一个参数
|
|
|
monitoredItems?.Add(monitoredItem); //添加至集合
|
|
|
}
|
|
|
@@ -946,9 +938,6 @@ namespace YSAI.Opc.ua.client
|
|
|
//在服务器上创建订阅并添加所有监视项
|
|
|
subscription.Create();
|
|
|
|
|
|
- // 将任何更改应用于订阅项
|
|
|
- subscription.ApplyChanges();
|
|
|
-
|
|
|
//把此订阅添加到集合,方便后续移除订阅(当存在此键则更新值,不存在则添加)
|
|
|
allSubscriptions?.AddOrUpdate(Tag, subscription, (k, v) => subscription);
|
|
|
|
|
|
@@ -1278,9 +1267,13 @@ namespace YSAI.Opc.ua.client
|
|
|
AC.CertificateValidator = certificateValidator;
|
|
|
AC.ServerConfiguration = new ServerConfiguration
|
|
|
{
|
|
|
+ //最大订阅数
|
|
|
MaxSubscriptionCount = int.MaxValue,
|
|
|
+ //为每个订阅保存在队列中的最大消息数
|
|
|
MaxMessageQueueSize = int.MaxValue,
|
|
|
+ //队列中为每个监视项目保存的通知的最大数量
|
|
|
MaxNotificationQueueSize = int.MaxValue,
|
|
|
+ //最大发布请求计数
|
|
|
MaxPublishRequestCount = int.MaxValue
|
|
|
};
|
|
|
|