API Guides > ConceptRT 3.x
DynamicInvocation/1.Client/main.cpp

Example of client connection detection and invocation of remote methode. This example works with the demo generator example.

#include "ConceptRTOs.h"
using namespace ConceptRT;
{
}
{
DynamicInvocationClientChannelUdp channelOcf("localhost", 10000);
DynamicInvocationClientObjectRoot rootOcf(channelOcf);
bool connected = false;
// Test connection to the remote application
if (rootOcf.OpenMetaData())
{
rootOcf.CloseMetaData();
System::GetConsole().WriteLine("Target application connected");
connected = true;
}
else
System::GetConsole().WriteLine("Target application not connected");
if (connected)
{
// Code depending of the target application structure
rootOcf.GetChild("Generators", Generators, true);
Generators.GetChild("Sinus", SinusGenerator, true);
// Invoke a method with return value
Float32 amplitude = SinusGenerator.Evaluate("Amplitude");
System::GetConsole().WriteLine("Target application Sinus generator amplitude : " + ToString(amplitude));
}
// put your code here
}