I have the following scenario when using OpenSplice DDS:
A publisher publishes a DDS topic instance continuously. A subscriber subscribes data using NoOpDataReaderListener, my test runs both publisher and subscriber at the same and the method on_data_available
of NoOpDataReaderListener in the subscriber print out the data content using std::cout
.
My problem is that data is not printed out all the time when you run the test many runs even though the on_subscription_matched
method of NoOpDataReaderListener is invoked during every run which indicating the matching of publisher and subscriber is successful. But the on_data_available
does not always print out the data content.
Even I replace the data content printing out inside on_data_available with std::cout
<< data do come in
, that message doesn’t appear all the time, only probably 7 out of 10 runs (7 runs all DDS samples can be seen from Subscriber, another 3 runs no DDS samples come out from Subscriber at all). So I think it is more to do with DDS problem instead of std out not being flushed out. Does anyone have idea or how to diagnostic DDS communication channel problem?
Some more information, with wireshark, I have observed the following:
it looks like whether the run is successful (subscriber successfully getting data from publisher) depends on if the user unicast port in publisher process can send data (RTPS DATA instead of just RTPS Heartbeat) to user multicast locator (239.255.0.1::multicast_port) in subscriber process.