I have the following code, but it is still sending UDP4 through ethernet. Does anybody know why? And how do I set it share memory only?
struct DDS_DomainParticipantQos *participant_qos = &DDS_PARTICIPANT_QOS_DEFAULT; DDS_DomainParticipantFactory_get_default_participant_qos(DDS_TheParticipantFactory, participant_qos); participant_qos->transport_builtin.mask = DDS_TRANSPORTBUILTIN_SHMEM; participant = DDS_DomainParticipantFactory_create_participant( DDS_TheParticipantFactory, domainId, participant_qos, NULL, DDS_STATUS_MASK_NONE); if (participant == NULL) { printf("create_participant error\n"); publisher_shutdown(participant); return -1; }
Hello,
If you want to disable UDPv4 transport programatically to use just Shared Memory, use the following snippet:
You may also change these QoS settings via XML:
Please let me know if it works for you.
Fernando
I think it is working. I have one question though. What is the difference between DDS_PARTICIPANT_QOS_DEFAULT and DDS_DomainParticipantQos_INITIALIZER?
I get the DDS_PARTICIPANT_QOS_DEFAULT from the rti code generator.
Thanks
Hi,
DDS_DomainParticipantQos_INITIALIZER
is a constant that can be used to initializeDDS_DomainParticipantQos
variables when you declare them in the stack or "malloc" them. The purpose is to give them some values that are not the random ones that you would get from the compiler (which can cause problems if you try to display the variable. For example a member that is a pointer could be set by the compiler to point to a random value and if you tried to print it you would get an error). Initializing a variable withDDS_DomainParticipantQos_INITIALIZER
does not set the variable to the DDS defaults. Just some non-random values. You can initialize variables as in this:But you should not pass it to functions that expect a DDS_DomainParticipantQos because the actual values set are not so useful. The only real thing you can do after assigning
DDS_DomainParticipantQos_INITIALIZER
to variable is to do a get_qos() or similar operation that fills it completely with some useful values.DDS_PARTICIPANT_QOS_DEFAULT
represents an actual variable that is pre-defined to contain the "default DDS values". The purpose is to have a pre-defined QoS that you can pass to functions that expect a DDS_DomainParticipantQos (e.g. the create_participant()) when you want to create it using the default QoS. However you cannot initialize a value using theDDS_PARTICIPANT_QOS_DEFAULT
because the byte-by-byte copy that the C compiler would give you as a result of the assignment does not work well for nested structures that contain pointers and such.Gerardo