Exchange data between nodes in OMNeT++

半腔热情 提交于 2020-02-06 09:58:27

问题


I'm using OMNeT++ to simulate a network. The messages exchanged between nodes are type integer and complex number.

How can I exchange the type of data between different nodes, because cMessage cannot accept integer and complex data.


回答1:


You can easily define custom messages with any content using .msg files. Take a look at the corresponding chapter in the Simulation Manual. This way you can define your "complex" type message, by adding two fields of type double, named for example re and im. The message compiler will generate a subclass of cMessage from this definition, which you can use for communication between nodes.



来源:https://stackoverflow.com/questions/50814059/exchange-data-between-nodes-in-omnet

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!