Perhaps you want to use one of the builtin transports, but need to modify the properties. (For default values, please see the API Reference HTML documentation.) Used together, the two operations below allow you to customize properties of the builtin transport when it is implicitly registered (see Builtin Transport Plugins).
Note: Another way to change the properties is with the Property QosPolicy, see Setting Builtin Transport Properties with the PropertyQosPolicy. Changing properties with the Property QosPolicy will overwrite the properties set by calling set_builtin_transport_property().
DDS_ReturnCode_t NDDSTransportSupport::get_builtin_transport_property( DDSDomainParticipant * participant_in, DDS_TransportBuiltinKind builtin_transport_kind_in, struct NDDS_Transport_Property_t &builtin_transport_property_inout) DDS_ReturnCode_t NDDSTransportSupport::set_builtin_transport_property( DDSDomainParticipant * participant_in,
DDS_TransportBuiltinKind builtin_transport_kind_in,
const struct NDDS_Transport_Property_t &builtin_transport_property_in)
Where:
participant_in |
A valid non-NULL DomainParticipant that has not been enabled. If the DomainParticipant if already enabled when this operation is called, your transport property changes will not be reflected in the transport used by the DomainParticipant's DataWriters and DataReaders. |
builtin_transport_kind_in |
The builtin transport kind for which to specify the properties. |
builtin_transport_property_inout |
(Used by the “get” operation only.) The storage area where the retrieved property will be output. The specific type required by the builtin_transport_kind_in must be used. |
builtin_transport_property_in |
(Used by the “set” operation only.) The new transport property that will be used to the create the builtin transport plugin. The specific type required by the builtin_transport_kind_in must be used. |
In this example, we want to use the builtin UDPv4 transport, but with modified properties.
/* Before this point, create a disabled DomainParticipant */ struct NDDS_Transport_UDPv4_Property_t property =
NDDS_TRANSPORT_UDPV4_PROPERTY_DEFAULT; if (NDDSTransportSupport::get_builtin_transport_property( participant, DDS_TRANSPORTBUILTIN_UDPv4,
(struct NDDS_Transport_Property_t&)property) !=
DDS_RETCODE_OK) { printf("**Error: get builtin transport property\n"); } /* Make your desired changes here */ /* For example, to increase the UDPv4 max msg size to 64K: */ property.parent.message_size_max = 65535; property.recv_socket_buffer_size = 65535; property.send_socket_buffer_size = 65535; if (NDDSTransportSupport::set_builtin_transport_property( participant, DDS_TRANSPORTBUILTIN_UDPv4, (struct NDDS_Transport_Property_t&)property) != DDS_RETCODE_OK) { printf("***Error: set builtin transport property\n"); } /* Enable the participant to turn on communications with other participants in the DDS domain using the new properties for the automatically registered builtin transport plugins */ if (entity->enable() != DDS_RETCODE_OK) { printf("***Error: failed to enable entity\n"); }
Note:Builtin transport property changes will have no effect after the builtin transport has been registered. The builtin transports are implicitly registered when (a) the DomainParticipant is enabled, (b) the first DataWriter/DataReader is created, or (c) you lookup a builtin DataReader, whichever happens first.
© 2017 RTI