Hi,
I've seen the examples of how to set up a reader_qos for multicast in C++.
Sadly, I couldnt easily translate this to work in java.
is there an example of this anywhere or can anyone share?
I assume it's only 1 or 2 lines of code in the reader_qos to add the address?
Hi lmc_aaron,
You can specify the reader's multicast address either programatically:
// ... // Get Default Reader's QoS and modify it before creating // the actual reader. DataReaderQos reader_qos = new DataReaderQos(); subscriber.get_default_datareader_qos(reader_qos); // Configure multicast settings and update the Reader's QoS // accordingly TransportMulticastSettings_t multicastSettings = new TransportMulticastSettings_t(); multicastSettings.receive_address = InetAddress.getByName("239.255.1.2"); multicastSettings.receive_port = 3456; reader_qos.multicast.value.add(multicastSettings); reader_qos.multicast.kind = TransportMulticastQosPolicyKind.AUTOMATIC_TRANSPORT_MULTICAST_QOS; // Create DataReader with modified QoS reader = (HelloWorldDataReader) subscriber.create_datareader( topic, reader_qos, listener, StatusKind.STATUS_MASK_ALL); if (reader == null) { System.err.println("create_datareader error\n"); return; } // ...or via XML:<dds> <qos_library name="MulticastTTLLibrary"> <qos_profile name="DefaultProfile"> <datareader_qos> <multicast> <value> <element> <receive_address>239.255.1.2</receive_address> <receive_port>3456</receive_address> </element> </value> <kind>AUTOMATIC_TRANSPORT_MULTICAST_QOS</kind> </multicast> </datareader_qos> </qos_profile> </qos_library> </dds>Thanks,
Fernando.