OpenHiva::ServiceClient::InvokeService

Description

The client sends requests to the server.

Prototype

template <typename ReqType, typename ResType> uint32_t OpenHiva::ServiceClient::InvokeService(ReqType req, ResType &res, const uint32_t timeout = 5000U)

Parameters

Parameter

Input/Output

Description

req

Input

Request message type, which must be a subclass of HivaMessage.

timeout

Input

Time limit, which can be set by users. The default value is 5000 ms.

res

Output

Type of the response message obtained from the server. The value must be a subclass of HivaMessage.

Returns

The return value is of the uint32_t type. If the operation is successful, HIVA_SUCCESS (value being 0) is returned. If other values are returned, the operation fails.

Usage

Only ServiceClient returned after OpenHiva::Node::CreateClient is invoked can work properly.

Precautions

The message types must match those of the request and response messages registered by OpenHiva::Node::CreateClient.