Hi,
I have a problem when using livelinessChangedStatus structure. In my project, I have one dataReader that listens to a topic which several dataWriters are publishing on. Every time when one or several dataWriters come offline/online due to network disconnect/reconnect, the function on_liveliness_changed(.....) is called, and I get a LivelinessChangedStatus struct. However, this struct only tells me the instance handle to the last remote writer that changed its liveliness, and this causes me a problem when several writers changed their liveliness at the same time.
How am I able to get all the instance handles to the remote writer that changed liveliness?
Hi Guanwen,
I was able to reproduce your issue. In the case of using waitset you will only get the last instance_handle if several DataWriters disconnect at the same time.
An alternative is to use a listener with the callback on_liveliness_changed(). This function will be called every time that the status is changed. Here you can see a snippet code about how to use it:
Let me know if this approach suits your needs.
Best,
Antonio