I check in an extra thread by calling the "AdsSyncReadDeviceInfoReqEx" function if the plc is still alive (every second).
When i get an Error (eg. 1861) i do "AdsDelRoute" and try to connect again via "AdsAddRoute" in a loop.
This occure sometimes when i restart the remote system via cerhost.
What can be the reason?
callhisotry:
I save all the handles for notifications, when the connection breaks i want to release the notification, this doesnt work so i save the "corrupt" handles in an error list. when i get the connection back i want to delete old device notification handles. Call: CloseErrors().
On a lucky punch everything worked fine and the logging looks like this:
1+2.) Get Timeout and "AdsDelRoute"
3.) AdsAddRoute() == 0 (no error)
4.) Delete old Notifications and Handles.
I dont close the Ports which i got with "AdsPortOpenEx"
Oh okay, I think I know what might be the problem.
NotificationDispatcher::erase() calls a callback function, which was bound to an AmsConnection instance. But that instance could be deleted by AdsDelRoute().
I check in an extra thread by calling the "AdsSyncReadDeviceInfoReqEx" function if the plc is still alive (every second). When i get an Error (eg. 1861) i do "AdsDelRoute" and try to connect again via "AdsAddRoute" in a loop.
This occure sometimes when i restart the remote system via cerhost. What can be the reason?
callhisotry: I save all the handles for notifications, when the connection breaks i want to release the notification, this doesnt work so i save the "corrupt" handles in an error list. when i get the connection back i want to delete old device notification handles. Call: CloseErrors().
On a lucky punch everything worked fine and the logging looks like this: 1+2.) Get Timeout and "AdsDelRoute" 3.) AdsAddRoute() == 0 (no error) 4.) Delete old Notifications and Handles. I dont close the Ports which i got with "AdsPortOpenEx"