I have the following code in my DDS program for java
DomainParticipantFactory.PARTICIPANT_QOS_DEFAULT. discovery.initial_peers.add("239.255.0.50");
DomainParticipantFactory.PARTICIPANT_QOS_DEFAULT. discovery.initial_peers.add("4@builtin.udpv4://127.0.0.1");
DomainParticipantFactory.PARTICIPANT_QOS_DEFAULT. discovery.initial_peers.add("builtin.shmem://");
DomainParticipantFactory.PARTICIPANT_QOS_DEFAULT.discovery.multicast_receive_addresses.clear();
DomainParticipantFactory.PARTICIPANT_QOS_DEFAULT.discovery.multicast_receive_addresses.add("239.255.0.50");
The setting of initial peers works correctly for the DDS code, however when I use the line to set the "multicast_receive_addresses" the address never gets set and keeps defaulting to the default multicast address. Why is my multicast address not getting set?
Hi Jason,
The proper way how to set initial_peers and multicast_receive_addresses programmatically in Java:
DomainParticipantQos qos =
new
DomainParticipantQos();
DomainParticipantFactory.get_instance().get_default_participant_qos(qos);
qos.discovery.initial_peers.clear();
qos.discovery.initial_peers.setMaximum(
3
);
qos.discovery.initial_peers.add(
"239.255.0.50"
);
qos.discovery.initial_peers.add(
"4@builtin.udpv4://127.0.0.1"
);
qos.discovery.initial_peers.add(
"builtin.shmem://"
);
qos.discovery.multicast_receive_addresses.clear();
qos.discovery.multicast_receive_addresses.setMaximum(
1
);
qos.discovery.multicast_receive_addresses.add(
"239.255.0.50"
);
participant = DomainParticipantFactory.TheParticipantFactory.
create_participant(domainId, qos,
null
, StatusKind.STATUS_MASK_NONE);
if
(participant ==
null
) {
System.err.println(
"create_participant error"
);
}
Let me know if it is working for you.
Best,
Antonio