AnsweredAssumed Answered

Reliable method of determining connection liveliness

Question asked by Mark.Derbecker on Nov 3, 2017
Latest reply on Dec 15, 2017 by Mark.Derbecker

We have an application that queries PIServer (PI) and PISystem (AF) periodically, and we have found that our queries can return PI connection exceptions when the server connection fails for some reason. That's good, and expected.


However, we need to detect this connection failure on a separate thread so that we can disconnect and attempt a reconnect. We have found that the ConnectionInfo.IsConnected property and ConnectChanged event are unreliable for determining connection liveliness. The former will return true even if the network adapter has been disabled, and ConnectChanged doesn't get fired.


Is this a known issue?


As a workaround, for PI, we are calling PIServer.PointCount (instead of ConnectionInfo.IsConnected), which appears to do a round-trip and will throw an exception if the connection is down.


The workaround for AF is to call PISystem.GetRpcMetrics(), which also appears to be a round-trip and will throw an exception.


Are these workarounds a bad idea?