简体   繁体   中英

UDP Broadcast to all nodes

I am trying to solve OMNET++ Ad hoc wireless UDP message to all nodes. My config file is as:

<config>
    <interface hosts='host*' address='192.168.0.x' netmask='255.255.255.x'/>
    <interface hosts='*' address='192.x.x.x' netmask='255.255.255.x'/>
</config>

and in ini file

*.host*.app[0].destAddresses = "255.255.255.255"  

but this is not working. destAddress can be set as

*.host*.app[0].destAddresses=moduleListByNedType("inet.node.inet.AdhocHost")

but this still randomly chooses one host at a time. How can I send packets to all nodes/hosts.

Indeed, 255.255.255.255 is a broadcast address, but if you are using Adhoc routing the various nodes are routers and the broadcast is not forwarded by them. If you insist using UDP you MUST modify the INET sources to support sending to multiple destinations instead of randomly choosing one. You can also use PingApp which does behave as you expect (ie if you specify * as a destination address it pings ALL node interfaces in the simulation).

If you need UDP, you should take a look at the PingApp sources and get an inspiration from there to modify the UDPBasicApp.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM