I am using RTI DDS 5.2.3.17
and would like to get the IP address of the DataWriter/Publisher
to add to some log messages.
How would I go about doing this I am having some trouble in just forming the logic of what to do?
Accessing the IP address of a DataWriter is not possible in a standardized way. However, the RTI Connext implementation by default uses the IP address as part of every Entity's Globally Unique Identifier (GUID).
You can find more information about GUIDs and how to access them in the RTI Knowledge Base article Accessing the GUID of Connext DDS Entities. Normally, the IP address is captured in the first 4 bytes of the GUID, indicated by rtps_host_id
in the DDS_GUID_t
diagram.
You did not explain your situation in too much detail, but if you happen to have data available coming from the DataWriter, you could also leverage the SampleInfo that comes with the data. It has a field called source_guid
.
All of this is assuming you are looking for the IPv4 address. Also note that this is not a publicly exposed mechanism, so things might change in the future. And all of this breaks at the moment that your application explicitly sets its GUID.