2.5. Configure UDP Transport¶
RTI Connext Micro comes with several transports. In this example we’ll use the UDP transport and register it with the Connext Micro run-time.
Configure the UDP transport properties:
struct UDP_InterfaceFactoryProperty *udp_property = NULL; udp_property = (struct UDP_InterfaceFactoryProperty *) malloc(sizeof(struct UDP_InterfaceFactoryProperty)); if (udp_property != NULL) { *udp_property = UDP_INTERFACE_FACTORY_PROPERTY_DEFAULT; /* allow_interface: Names of network interfaces allowed to receive. * Allow one loopback (lo) and one NIC (eth0). */ REDA_StringSeq_set_maximum(&udp_property->allow_interface,2); REDA_StringSeq_set_length(&udp_property->allow_interface,2); *REDA_StringSeq_get_reference(&udp_property->allow_interface,0) = DDS_String_dup("lo"); *REDA_StringSeq_get_reference(&udp_property->allow_interface,1) = DDS_String_dup("eth0"); } else { /* failure */ }
Register the UDP transport with updated properties:
if (!UDP_Interface_register(registry, "_udp",udp_property)) { /* failure */ }
For more details, see Datagram UDP Setup.