在RTI DDS上获取DataWriter / Publisher的IP地址? [英] Get IP Address of DataWriter/Publisher on RTI DDS?

查看:262
本文介绍了在RTI DDS上获取DataWriter / Publisher的IP地址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 RTI DDS 5.2.3.17 ,并希望获得 DataWriter / Publisher 的I​​P地址添加到一些日志消息。

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?

推荐答案

以标准化方式无法访问DataWriter的IP地址。但是,RTI上下文实现默认使用IP地址作为每个实体的全局唯一标识符(GUID)的一部分。

Accessing the IP address of a DataWriter is not possible in a standardized way. However, the RTI Context implementation by default uses the IP address as part of every Entity's Globally Unique Identifier (GUID).

您可以找到有关GUID以及如何访问的更多信息它们在RTI知识库文章访问Connext DDS实体的GUID 。通常,IP地址在GUID的前4个字节中捕获,由 rtps_host_id DDS_GUID_t 图表中指示。

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.

您没有详细解释您的情况,但如果您碰巧有来自DataWriter的数据,您还可以利用 SampleInfo 随数据提供。它有一个名为 source_guid 的字段。

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.

所有这一切都假设您正在寻找IPv4地址。另请注意,这不是一个公开的机制,因此将来可能会发生变化。当应用程序显式设置其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.

这篇关于在RTI DDS上获取DataWriter / Publisher的IP地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆