I'm trying to code in OMNeT++ an app that gets the queue length from the node where it is invoked and sends it to another node.
The plan is to modify the UdpBasicApp.cc file invoked in a router and make it get the length of the queue of the DropTailQueue module.
Searching online I found that this is the right method...
cModule *mod = getModuleByPath("router3.eth[*].mac.queue");
queueing::PacketQueue *queue = check_and_cast<queueing::PacketQueue*>(mod);
int c = queue->getNumPackets();
EV << c;
...since the DropTailQueue extends the PacketQueue module.
I put a print at the end to see if there was something wrong.
When I run the simulation, using the modified UdpBasicApp module, c is always 0.
I hardly doubt that the queue is always 0, but I don't know how to verify this doubt.
If it's an error, why is it always 0?
question from:
https://stackoverflow.com/questions/65874996/omnet-why-packetqueue-is-always-0 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…