Rate This Document
Findability
Accuracy
Completeness
Readability

CheckVersionMatch

Function Usage

Checks whether the server version matches the client version.

Restrictions

This API is used to check whether the server version matches the client version. It does not need to be implemented by secondary developers. In this case, its default implementation is used. By default, the API checks whether the server version is the same as the client version. If yes, true is returned. Otherwise, false is returned. If secondary developers implement this API, the instruction stream engine calls this function to verify the versions of the server and client. If false is returned during version verification, the engine reports an error code indicating that a version mismatch through the callback function registered by RegConnectionCB and terminates the connection.

Prototype

bool CheckVersionMatch(const char* serverVersion, const char* clientVersion)

Parameters

Parameter

Input/Output

Class

Description

serverVersion

Input

const char*

Stores the server version.

clientVersion

Input

const char*

Stores the client version.

Returns

Data type: bool

The value can be:

  • true: Verification succeeded
  • false: Verification failed

Example Call

// The function prototype declaration is implemented by users.
using CheckVersionMatchFunc = bool (*)(const char*, const char*);
const char *soPath = "./libCommunication.so";
void Test() 
{
    // Function symbol for dynamically loading the dynamic communication library
    void *handle = dlopen(soPath, RTLD_GLOBAL | RTLD_LAZY | RTLD_NODELETE);
    CheckVersionMatchFunc checkVersion = (CheckVersionMatchFunc)dlsym(handle, "CheckVersionMatch");
    checkVersion("Kunpeng BoostKit 22", "Kunpeng BoostKit 23");
    dlclose(handle);
}