Kepware Knowledge Base: Solution
ClientAce Application Is Getting Multiple DataChanged Events For Each Item
Last Update: 11/12/2018
Problem:A client application is designed to connect to a server once an hour get data changes before disconnecting. On the first connection, the application gets one DataChanged Event for all of the monitored items. On the next connection, the application gets two DataChanged Events for the monitored items. Each successive connection increases the number of DataChanged Events received for the monitored items. Even though the ClientAce application is creating a new unique connection on every cycle, the application is also creating a new event handler on every cycle. Because that event handler is not part of the server object, it is not destroyed when the application disconnects from the server. This means that the previous event handler still exists on each new connection.
Solution:
Only initialize the event handlers once on application start-up.
©
2021
PTC Inc. All Rights Reserved.