Multicast HelloWorld Subscriber under Micro

6 posts / 0 new
Last post
Offline
Last seen: 10 years 3 months ago
Joined: 12/30/2013
Posts: 6
Multicast HelloWorld Subscriber under Micro

Dear Community
I'm trying to create a Multicast HelloWorld subscriber, under the micro edition of RTI DDS in C.  But when I try to follow the examples I see on the web and in the documentation, I find that there's no multicast transport settings defined at the subscriber level.
Is there some documentation which I can refer to which would show me how to do this at the level of the domain participant?   I have HelloWorld working between my PC and my embedded system, but it's set up for unicast subscriber.  So every subscriber I create gets another set of messages for every update.  I want to prove out the mutlicast implementation, but so far I'm unable to find a clear description of how to do this


Thanks

Offline
Last seen: 10 years 3 weeks ago
Joined: 08/28/2013
Posts: 66

Hi,

For example, QoS to set for multicast on 239.255.0.1

QoS Participant:
*DDS_StringSeq_get_reference(&dp_qos.discovery.enabled_transports, 0) =DDS_String_dup("_udp://239.255.0.1");
*DDS_StringSeq_get_reference(&dp_qos.user_traffic.enabled_transports, 0) =DDS_String_dup("_udp://239.255.0.1");
*DDS_StringSeq_get_reference(&dp_qos.discovery.initial_peers,0) = DDS_String_dup("239.255.0.1");

 

QoS UDP:
udp_property->multicast_interface = REDA_String_dup(
"lo0"); or eth0 or your interface name

QoS DataReader:
*REDA_StringSeq_get_reference(&dr_qos.transport.enabled_transports,0) =
"239.255.0.1";

QoS DataWriter:
*REDA_StringSeq_get_reference(&dw_qos.transport.enabled_transports,0) ="239.255.0.1";

It should work.

Rodolf

Offline
Last seen: 6 years 1 month ago
Joined: 01/17/2013
Posts: 22

Hi Eric and Rodolf,

To receive user data over multicast with Connext Micro, it is configured on the DomainParticipant, with DomainParticipantQos.user_traffic.enabled_transports as you've done in the second line of your "QoS Participant."    

I verified this by taking the HelloWorld_dpde example from Micro 2.2.3, adding the following lines to HelloWorldApplication.c,

    DDS_StringSeq_set_maximum(&dp_qos.user_traffic.enabled_transports, 1);
    DDS_StringSeq_set_length(&dp_qos.user_traffic.enabled_transports, 1);
    *DDS_StringSeq_get_reference(&dp_qos.user_traffic.enabled_transports, 0) = 
        DDS_String_dup("_udp://239.255.0.1"); 



and running the example on a single machine to discover over loopback but send/receive user traffic over multicast.  I also verified with Wireshark that user traffic was being sent and received over the multicast address of 239.255.0.1.

Although the QoS are present, setting user_traffic for multicast with DataWriterQos and DataReaderQos is not yet supported.  Note that setting enabled_transports on the DataWriterQos and DataReaderQos needs to follow the same syntax as for DomainParticipantQos (for example "_udp://239.255.0.1" to use the built-in UDP transport with multicast address 239.255.0.1).  

Regards,

Edward

 

Offline
Last seen: 9 years 9 months ago
Joined: 01/16/2014
Posts: 4

Hello Gentlemen,

Thanks for your replies. I'm working on the same project as the etexley. I'm working from the snippets you've both posted to acheive the desired functionality using the HelloWorld_dpde example on a WIN32 platform. We're nearing completion of our connext micro port to our target platform, but we've hit a snag testing the multicast functionality we require. We'd like to get the windows example working first so we have something to compare with. Perhaps you could point out my mistakes or provide a working example?

 

    REDA_StringSeq_set_maximum(&udp_property->allow_interface,1);
    REDA_StringSeq_set_length(&udp_property->allow_interface,1);
    
	*REDA_StringSeq_get_reference(&udp_property->allow_interface,0) = "Local Area Connection";
	udp_property->multicast_interface = REDA_String_dup("Local Area Connection"); 
	
    if (!RT_Registry_register(registry, "_udp",
                         UDP_InterfaceFactory_get_interface(),
                        (struct RT_ComponentFactoryProperty*)udp_property, NULL))
    {
       printf("failed to register udp\n");
       goto done;
   }

    DDS_DomainParticipantFactory_get_qos(factory, &dpf_qos);
    dpf_qos.entity_factory.autoenable_created_entities = DDS_BOOLEAN_FALSE;
    DDS_DomainParticipantFactory_set_qos(factory, &dpf_qos);

    if (!RT_Registry_register(registry,
                              "dpde",
                              DPDE_DiscoveryFactory_get_interface(),
                              &discovery_plugin_properties._parent, 
                              NULL))
    {
        printf("failed to register dpde\n");
        goto done;
    }

	DDS_StringSeq_set_maximum(&dp_qos.discovery.enabled_transports,1);
	DDS_StringSeq_set_length(&dp_qos.discovery.enabled_transports,1);

	*DDS_StringSeq_get_reference(&dp_qos.discovery.enabled_transports, 0) =DDS_String_dup("_udp://239.255.0.1");

    DDS_StringSeq_set_maximum(&dp_qos.discovery.initial_peers,1);
	DDS_StringSeq_set_length(&dp_qos.discovery.initial_peers,1);
	*DDS_StringSeq_get_reference(&dp_qos.discovery.initial_peers,0) = DDS_String_dup("239.255.0.1");
	
	 DDS_StringSeq_set_maximum(&dp_qos.user_traffic.enabled_transports, 1);
	 DDS_StringSeq_set_length(&dp_qos.user_traffic.enabled_transports, 1);
     *DDS_StringSeq_get_reference(&dp_qos.user_traffic.enabled_transports, 0) = 
     DDS_String_dup("_udp://239.255.0.1"); 
	    
    /* if there are more remote or local endpoints, you need to increase these limits */
    dp_qos.resource_limits.max_destination_ports = 32;
    dp_qos.resource_limits.max_receive_ports = 32;
    dp_qos.resource_limits.local_topic_allocation = 1;
    dp_qos.resource_limits.local_type_allocation = 1;
    dp_qos.resource_limits.local_reader_allocation = 1;
    dp_qos.resource_limits.local_writer_allocation = 1;
    dp_qos.resource_limits.remote_participant_allocation = 8;
    dp_qos.resource_limits.remote_reader_allocation = 8;
    dp_qos.resource_limits.remote_writer_allocation = 8;

    application->participant =
        DDS_DomainParticipantFactory_create_participant(factory, domain_id,
                                                        &dp_qos, NULL,
                                                        DDS_STATUS_MASK_NONE);

    if (application->participant == NULL)
    {
        printf("failed to create participant\n");
        goto done;
    }

Offline
Last seen: 6 years 1 month ago
Joined: 01/17/2013
Posts: 22

Hi James,

Are you getting an error log message?  Or are you not getting successful communication?

Try removing line 5 of your code snippet ("udp_property->multicast_interface = REDA_String_dup("Local Area Connection");")

Regards,

Edward

 

 

 

Offline
Last seen: 9 years 9 months ago
Joined: 01/16/2014
Posts: 4

Hi Edward,

I was having some networking issues that were compounding my problem (not related to DDS). Also, line 5 of the snippet is unnecessary as you mentioned. Using the above code (without line 5) I can get the Connext Micro HelloWorld publisher and subscriber applications to talk to each other. Thanks!