Does Endpoint Discovery use unicast or multicast?

Endpoint Discovery uses either unicast or multicast, depending on the situation.

First, some background: Endpoint Discovery is the process used by endpoints (that is, DataReaders and DataWriters) to locate each other before they can begin to communicate user data.

When a DomainParticipant is created, it will announce itself on the network and listen for announcements from other DomainParticipantsthis process is known as Participant Discovery.

When a DataReader or DataWriter is created, their DomainParticipant will announce them to other DomainParticipants in order to locate any matching DataReaders or DataWriters—this process is known as Endpoint Discovery.

In Wireshark, the DomainParticipant’s announcements are displayed as DATA(p) packets, and the DataReader’s and DataWriter’s announcements are displayed as DATA(r) and DATA(w) packets, respectively.

An initial heartbeat and preemptive ACKNACK (sent by the built-in endpoint DataReader and DataWriter respectively) are sent before the endpoint discovery announcements. These indicate the start of the endpoint discovery phase. This ACKNACK and heartbeat are part of an optimization that is used to kickstart the discovery process. By sending the ACKNACK preemptively, the built-in endpoint DataWriter doesn’t need to wait for a periodic ACKNACK to arrive before commencing with discovery. For more information about preemptive ACKNACKs and heartbeats, please see What are preemptive ACKNACK and preemptive heartbeat messages?

The Endpoint Discovery announcements are published using the DomainParticipant’s built-in DataReaders and DataWriters. These built-in endpoints have a History QoS kind of KEEP_LAST and depth of 1, meaning the DataWriters store their most recent sample as historical data to be sent to any late joining DataReaders.

There are therefore two cases:

  • If Participant Discovery is yet to complete when Endpoint Discovery announcements are published, the announcements will be stored as historical data and published once a matching built-in DataReader is discovered. In this case, since the samples are sent as historical data, they are sent using unicast.
  • If Participant Discovery has already completed when Endpoint Discovery begins, the announcements are sent as live data. They will be sent using either unicast or multicast, depending on whether or not multicast_receive_addresses contains a valid multicast IP address. See information about multicast_receive_addresses in the API Reference HTML documentation.

After discovery, if reliable communication is used, repair messages will only be sent as multicast if the number of ACKNACKs coming from the same multicast group exceeds RtpsReliableWriterProtocol_t::multicast_resend_threshold within a single response-delay (configured using RtpsReliableWriterProtocol_t::min/max_nack_response_delay).

For more information about discovery, see the Discovery chapter in the RTI Connext DDS Core Libraries User’s Manual.