C-nano Client#
This page covers using the kRPC C-nano client with the KSA service.
Installing#
The server listens over TCP/IP, so build the kRPC C-nano client 0.7.0 with its
tcp feature, for example from vcpkg:
vcpkg install "krpc-cnano[tcp]"
Add cnano/include from the stubs folder of the release archive to the include
path.
Using the KSA Service#
Open the connection with the address and RPC port of the server. Include krpc_cnano.h
before the service header:
#include <stdio.h>
#include <stdlib.h>
#include <krpc_cnano.h>
#include <krpc_cnano/services/ksa.h>
krpc_connection_t conn;
krpc_connection_config_t config = {"127.0.0.1", 50000};
krpc_open(&conn, &config);
krpc_connect(conn, "Example");
krpc_KSA_Vehicle_t vehicle;
krpc_KSA_ActiveVehicle(conn, &vehicle);
char * name = NULL;
krpc_KSA_Vehicle_Name(conn, &name, vehicle);
printf("%s\n", name);
free(name);
The kRPC C-nano client guide covers the build options and the client’s other features.