I have to send the same message to multiple modules. I used the following code:
cMessage *msg=new cMessage("Broadcast");
msg->setKind(SENDTOALL);
cTopology topo;
topo.extractByModulePath(cStringTokenizer("**.router*.app[0]").asVector());
cTopology::Node *thisNode = topo.getNodeFor(this);
for (int i = 0; i < topo.getNumNodes(); i++) {
if (topo.getNode(i) == thisNode) continue; // skip ourselves
cModule *targetModule =topo.getNode(i)->getModule();
EV_INFO << "Get Full Name ------------------- "<<i<< topo.getNode(i)->getModule()->getFullPath()<<endl;
sendDirect(msg,targetModule,"in");
after sending the message to the first module and trying to send to the next module, I get the following error that the message already scheduled and the simulation stops at this point.
Can I get any advice? I will be really thankful.
Thank you in advance.
question from:
https://stackoverflow.com/questions/65879799/i-get-an-error-when-trying-to-send-to-multiple-modules-using-senddirect 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…