简体   繁体   English

如何处理与OPC服务器的连接中止

[英]How to handle connection abort to OPC Server

I have written a library which connects to an opc server and creates subscriptions to get notified about data changes. 我编写了一个库,该库连接到opc服务器并创建订阅以获取有关数据更改的通知。 There is also an event which get fired when the opc server is going to shutdown. 当opc服务器即将关闭时,还会触发一个事件。 I am using the OPC .NET API and C#. 我正在使用OPC .NET API和C#。

How can I handle a connection abort due to a network failure (server crashes, cable gets unplugged)? 如何处理由于网络故障(服务器崩溃,电缆拔出)而导致的连接中止?

There is no precise way to do this, there are some techniques to mitigate the issues like having a heartbeat monitor that checks the status of the OPC server, this can be done in various ways from checking the actual server status or check some counter on the server. 没有精确的方法来执行此操作,有一些技术可以减轻此类问题,例如具有检测OPC服务器状态的心跳监视器,这可以通过多种方式完成,包括检查实际服务器状态或检查服务器上的某些计数器。服务器。

You also need to check if your subscriptions are still active since the are of type Observer pattern you may not know whether something went wrong and the subscriptions stop working. 您还需要检查您的订阅是否仍处于活动状态,因为它们是Observer模式的类型,因此您可能不知道是否出现问题以及订阅是否停止。 This can be done by measuring the time since last fired data change event but it depends a bit on traffic that you expect. 这可以通过测量自上次触发数据更改事件以来的时间来完成,但这在一定程度上取决于您期望的流量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM