如何为 OMNeT++ 中的动态节点分配 IP 地址?

How to assign an IP address to a dynamic node in OMNeT++?

我已经成功创建了一个动态节点,但是 Ipv4Configurator 没有为这个新节点分配 IP 地址。如何为该节点的 wlan 接口分配 IP 地址?

谢谢

看看examples/adhoc/hostautoconf。这个例子正好解决了你的问题。 HostAutoConfigurator 模块声明:

HostAutoConfigurator automatically assigns IP addresses and sets up routing table. It has to be added into each host.

This configurator is deprecated. Please use IPv4NetworkConfigurator whenever it is possible. This module is kept only because the IPv4NetworkConfigurator cannot assign IP addresses to modules that are dynamically created/destroyed.