RTI DDS Src HostId to IP Address



我使用RTI DDS Spy来调试DDS应用程序。我注意到间谍工具中的奇怪消息,我相信不是来自我的应用程序。

问题是如何获取Src HostId并计算出发送方的IP地址?(不支持Wireshark)

Src HostId字段一般为源IP地址的十六进制形式。例如,使用Spy的以下输出:

source_timestamp   Info  Src HostId  topic               type              
-----------------  ----  ----------  ------------------  ------------------  
1369074721.938245  R +N  C0A80103    CellTopic           life::CellType    
1369074721.937270  W +N  C0A80103    CellTopic           life::CellType    
1369074721.938615  D +N  C0A80103    CellTopic           life::CellType    
1369074721.938726  D +N  C0A80103    CellTopic           life::CellType    

查看第三列C0 A8 01 03中的四个字节,将它们从十六进制依次转换为十进制得到192.168.1.3(因为C0是十进制的192, A8168,显然011, 033)。

顺便说一下,关于Src HostId的更多细节,也可以查看使用rtiddsspy -hOutput的帮助:

Src HostId         :   Contains the sourceId part of the Global Unique 
                       IDentifier (GUID) of the writer that sent the sample.
                       This value is formatted as an IP address because this
                       is the default setting for NDDS. Consequently this
                       column will match the IP address of the sender
                       of the message provided that: (1) the application is
                       running on an IP network, (2) it has not disabled the
                       UDPv4 transport and (3) it has not explicitly 
                       overridden the 'appId'

最新更新