Table Of Contents
Table Of Contents

Preventing a Queue from Becoming Empty

The QueueFiller module creates packets whenever a connected queue becomes empty. One use of this module is to generate continuous traffic on a network interface.

In this example network, an active packet sink (ActivePacketSink) periodically pops packets from a queue (PacketQueue). Whenever the queue becomes empty, a queue filler module (QueueFiller) pushes a packet into it.

../../../_images/QueueFillerNetwork.png
../../../_images/QueueFiller.png
network QueueFillerTutorialStep
{
    @display("bgb=600,200");
    submodules:
        filler: QueueFiller {
            @display("p=100,100");
            tokenGenerator.queueModule = "queue";
        }
        queue: PacketQueue {
            @display("p=300,100");
        }
        collector: ActivePacketSink {
            @display("p=500,100");
        }
    connections allowunconnected:
        filler.out --> queue.in;
        queue.out --> collector.in;
}
[Config QueueFiller]
network = QueueFillerTutorialStep
sim-time-limit = 10s

*.filler.provider.packetLength = 1B
*.collector.collectionInterval = 1s