Page 1 of 1

Pointer to RCF::RcfClient

Posted: Tue Dec 13, 2016 10:31 pm
by lucimur
Hi All,

I'm trying to figure out how to send a protobuf::message via a RCF::RcfClient. I'm trying to send a "heartbeat" message via multicast as described here:

http://www.deltavsoft.com/doc/rcf_user_ ... ations.Udp

But can't figure out the syntax for how to make this work. More specifically, the reference above includes the following:

RcfClient<I_Echo> client( RCF::UdpEndpoint("232.5.5.5", 50001) );
client.Echo(RCF::Oneway, "ping");

How do I create the "I_Echo" template when I'm just want to send a protobuf::message?

There's no RPC, or client/server component here, per se, rather I just want to transmit this message on a given multicast address and port.

Many thanks,

Lucimur

Re: Pointer to RCF::RcfClient

Posted: Tue Dec 13, 2016 10:58 pm
by jarl
Hi,

There is a null interface you can use:

Code: Select all

RCF::RcfClient<RCF::I_Null> client( RCF::UdpEndpoint("232.5.5.5", 50001) );

Re: Pointer to RCF::RcfClient

Posted: Wed Dec 14, 2016 3:51 pm
by lucimur
Hi Jarl,

Thanks for your response. I'm new to RCF and relatively new to "template" programming and protobuf, so please excuse my questions if they're somewhat trivial in nature.

I just don't think that I'm "getting it". Here's my situation: I will have a number of "slave" applications that will reside on a network and advertise their existence for discovery (via a multicast message) by a central "master" application. Once discovered by the master program, the master program will utilize remote service calls to each of the slaves to affect various aspects of control. The latter portion of this functionality seems straight forward for RCF/RCFProto, as the provided examples describe exactly what I want to do.

I'm encountering difficulty with the first part (transmit/receive protobuf message via multicast). I know exactly how to achieve this using sockets directly, but would like to determine if RCF/RCFProto can provide a more elegant way of handling this (and allow me to avoid adding one more library to my project!).

My proto file looks like this:

Code: Select all

message HeartbeatMsg
{
	required string name = 1;
	required string type = 2;
	required string endpoint = 3;
}
Each "slave" application will transmit this message on a defined multicast address and port once a second. Note that the "endpoint" field will contain the IP address and port that the "master" program should use for connecting to the "slave" and invoking services.

How would I use RCF/RCFProto to open a socket and send a protobuf message to a given multicast address and port? How would I use RCF/RCFProto to setup the master to receive messages sent to this multicast address and port?

Many thanks,

Lucimur

Re: Pointer to RCF::RcfClient

Posted: Tue Feb 21, 2017 2:47 am
by jarl
Hi Lucimur,

Sorry for the late response. You can do this with RCF by creating a RcfClient<> with a UdpEndpoint, passing in a UDP multicast IP. Then when you make a remote call on the RcfClient<>, the message will be broadcast on the UDP multicast IP.

To use protobuf messages, generate C++ code for your protobuf messages, and then use the resulting generated message classes in your RCF interface, as described here:

http://www.deltavsoft.com/doc/rcf_user_ ... .Protobufs