akenyon

PIServer.Connect() & PIServer.Disconnect()

Discussion created by akenyon on Oct 10, 2014
Latest reply on Nov 25, 2019 by gregor

Hi all,

 

I'm working on a continuously running service and I've run into some odd behavior. The service is very simple; poll a web service every few seconds and write new data to PI. Previously we ran into an issue where the service would think that it was writing to PI (no exceptions etc) yet the data would never make it to PI. This occurred after the service had run for several months, making it very difficult to replicate and test. We opted to to use Connect() and Disconnect() to explicitly connect to the PI Server in hope that the issue would be resolved. We recently found that explicitly using PIServer.Connect() and PIServer.Disconnect() would create a new connection to the PI Server but would not close the old connection. Using the Network Manager Statistics pane of PI SMT (Operation --> Network Manager Statistics) we would see upwards of 50 connections coming from our application. After 60 or so connections we would beging to see older connections start to disappear. 

 

I did find this article where David Hern mentions that PIServer.Connect() and PIServer.Disconnect() shouldn't be used as it's expensive and the AFSDK automatically manages the connection. This is the only information I've been able to find on the subject as the AFSDK Reference Manual only mentions that PIServer.Disconnect() and PIServer.Connect() should be used for explicitly connecting to PI. 

 

I wondering why these connections are not being closed on the PI Server? or by the AFSDK? or maybe there is a way to close these connections and I haven't found it yet. The AFSDK Reference manual makes no mention of this behavior; additionally this behavior seems very unintuitive as to what one might excpect of PIServer.Connect() and PIServer.Disconnect().

 

Has anybody else ran into the same issue or found this to be a problem?

Outcomes