Connection status callback on a deleted session ID

Questions regarding the use of the ANSI C SDK for Server or Client development or integration into customer products ...

Moderator: uasdkc

Post Reply
jfsi
Full Member
Full Member
Posts: 5
Joined: 14 Sep 2017, 08:35

Connection status callback on a deleted session ID

Post by jfsi »

It looks like my connection status callback is called with a session ID that I deleted with UaClient_Session_Delete().
How can I avoid this? Alternatively, is there a way to validate a session ID?

jfsi
Full Member
Full Member
Posts: 5
Joined: 14 Sep 2017, 08:35

Re: Connection status callback on a deleted session ID

Post by jfsi »

Ok, I found a way to avoid deleting the session.

User avatar
Support Team
Hero Member
Hero Member
Posts: 3068
Joined: 18 Mar 2011, 15:09

Re: Connection status callback on a deleted session ID

Post by Support Team »

Hello jfsi,

when calling UaClient_Session_Delete(), you need to check the returned status code to see if it actually worked. If the session is not disconnected, the delete call will fail, as there still might come callbacks for the session. Only if you get the ConnectionStatusChanged_CB with UaClient_ConnectionStatus_Disconnected, you can be sure that there will be no more callbacks and the session can be deleted.
Best regards
Unified Automation Support Team

Post Reply