Stopping the libraries

After you have done with using the libraries, you can stop the libraries.

Stopping the libraries will releases resources taken by the libraries

Stream library uses Access library internally. So, stopping the Access before Stream will make the Stream library to go to inconsistent state.
So, the Stream is recommended to stop if started before stopping the Access library.

Stopping the Stream Library

To stop the Stream library, call stop() method of Stream class.

This is a thread blocking operation.

StreamRet streamStopResult = AnyConnectApi.get().getStream().stop();
if (streamStopResult == StreamRet.OK) {
    //The stream library is stopped successfully
} else {
    //The stream library has failed to stop
}
StreamRet streamStopResult = stream->stop([self](){
            // Tasks after stream library stopped
        });
if(streamStopResult == OK){
    //The stream library is stopped successfully
}else{
    //The stream library has failed to stop
}

See the StreamRet section for details about streamStopResult.

Stopping the Access Library

To stop the Access library, call stop() method of Access class.

This is a thread blocking operation.

AccessRet accessStopResult = AnyConnectApi.get().getAccess().stop();
if(accessStopResult == AccessRet.OK){
    //The access library is stopped successfully
}else{
    //The access library has failed to stop
}
AccessRet accessStopResult = access->stop([self](const int& status){
                // Tasks after access library stopped
            });
if(accessStopResult == OK){
    //The access library is stopped successfully
}else{
    //The access library has failed to stop
}

See the Status Codes section for details about status of stop() callback.

See the AccessRet section for details about accessStopResult.