Respond to events such as Client Register, Client Deregister and Client Update.
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <signal.h>
#define IPC_PORT (54321)
#define IPC_ADDRESS "127.0.0.2"
#define OPERATION_PERFORM_TIMEOUT 1000
static void clientRegisterCallback(const AwaServerClientRegisterEvent * event, void * context)
{
int * eventCount = (int *)context;
(*eventCount)++;
{
printf("Event %d: Client %s registered:\n ", *eventCount, clientID);
{
}
printf("\n");
}
}
static void clientDeregisterCallback(const AwaServerClientDeregisterEvent * event, void * context)
{
int * eventCount = (int *)context;
(*eventCount)++;
{
printf("Event %d: Client %s deregistered.\n", *eventCount, clientID);
}
}
static void clientUpdateCallback(const AwaServerClientUpdateEvent * event, void * context)
{
int * eventCount = (int *)context;
(*eventCount)++;
{
printf("Event %d: Client %s updated:\n ", *eventCount, clientID);
{
}
printf("\n");
}
}
static bool stopFlag = false;
static void stop(int ignore)
{
printf("Exiting...\n");
stopFlag = true;
}
int main(void)
{
signal(SIGINT, stop);
int eventCount = 0;
while (!stopFlag)
{
}
return 0;
}