You are here: Part 8: RTI TCP Transport > Configuring the TCP Transport > Configuring the TCP Transport with the Property QosPolicy

Configuring the TCP Transport with the Property QosPolicy

The PROPERTY QosPolicy (DDS Extension) allows you to set up name/value pairs of data and attach them to an entity, such as a DomainParticipant.

Like all QoS policies, there are two ways to specify the Property QoS policy:

Programmatically, as described in this section and Getting, Setting, and Comparing QosPolicies. This includes using the add_property() operation to attach name/value pairs to the Property QosPolicy and then configuring the DomainParticipant to use that QosPolicy (by calling set_qos() or specifying QoS values when the DomainParticipant is created).

With an XML QoS Profile, as described in Configuring QoS with XML. This causes Connext DDS to dynamically load the TCP transport library at run time and then implicitly create and register the transport plugin.

To add name/value pairs to the Property QoS policy, use the add_property() operation:

DDS_ReturnCode_t DDSPropertyQosPolicyHelper::add_property  
(DDS_PropertyQosPolicy policy, const char * name,
const char * value, DDS_Boolean propagate)

For more information on add_property() and the other operations in the DDSPropertyQosPolicyHelper class, see Table 57 PropertyQoSPolicyHelper Operations, as well as the API Reference HTML documentation.

The ‘name’ part of the name/value pairs is a predefined string. The property names for the TCP Transport are described in Table 1 .

Here are the basic steps, taken from the example Hello World application (for details, please see the example application.)

Get the default DomainParticipant QoS from the DomainParticipantFactory.

DDSDomainParticipantFactory::get_instance()->
    get_default_participant_qos(participant_qos);

Disable the builtin transports.

participant_qos.transport_builtin.mask = 
    DDS_TRANSPORTBUILTIN_MASK_NONE;

Set up the DomainParticipant’s Property QoS.

Load the plugin.

DDSPropertyQosPolicyHelper::add_property (
    participant_qos.property, 
    "dds.transport.load_plugins",
    "dds.transport.TCPv4.tcp1",
    DDS_BOOLEAN_FALSE);

Specify the transport plugin library.

DDSPropertyQosPolicyHelper::add_property (
    participant_qos.property, 
    "dds.transport.TCPv4.tcp1.library",
    "nddstransporttcp", 
    DDS_BOOLEAN_FALSE);

Specify the transport’s ‘create’ function.

DDSPropertyQosPolicyHelper::add_property (
    participant_qos.property,
    "dds.transport.TCPv4.tcp1.create_function", 
    "NDDS_Transport_TCPv4_create", DDS_BOOLEAN_FALSE);

Set the transport to work in a WAN configuration with a public address:

DDSPropertyQosPolicyHelper::add_property (
    participant_qos.property, 
    "dds.transport.TCPv4.tcp1.parent.classid",
    ”NDDS_TRANSPORT_CLASSID_TCPV4_WAN”, DDS_BOOLEAN_FALSE);
DDSPropertyQosPolicyHelper::add_property (
    participant_qos.property, 
    "dds.transport.TCPv4.public_address", 
    "182.181.2.31", 
    DDS_BOOLEAN_FALSE);

Specify any other properties, as needed.

Create the DomainParticipant using the modified QoS.

participant = 
    DDSTheParticipantFactory->create_participant (
        domainId,
        participant_qos, 
        NULL /* listener */, 
        DDS_STATUS_MASK_NONE);

Important!Property changes should be made before the transport is loaded—either before the DomainParticipant is enabled, before the first DataWriter/DataReader is created, or before the builtin topic reader is looked up, whichever one happens first.

© 2015 RTI