DCSModulesAPI  1.0.0
DCS sub project containing all the control modules as libraries.
sockets/simple_client.cpp

An example showing how to implement a simple client.

#include <iostream>
int main()
{
using namespace DCS::Network; // For Client and Socket
Socket c = Client::Connect("127.0.0.1", 15777);
// Create a message to execute a server call
unsigned char buffer[512];
SV_CALL_DCS_Threading_addInt,
42, 1);
// Send data to execute function in server and waits for response
auto sum_r = Message::SendSync(Message::Operation::REQUEST, buffer, size);
std::cout << "42 + 1 = " << *(int*)sum_r.ptr << std::endl;
std::this_thread::sleep_for(std::chrono::milliseconds(1000)); // Wait one second to issue stop command
return 0;
}