Table Of Contents
Table Of Contents

Cloning Packets from One Input To Multiple Outputs

The PacketCloner module has one input gate and multiple output gates. Packets pushed to the input are copied and pushed out on all outputs.

In this example network, packets are created by an active packet source (ActivePacketSource). The packet source pushes packets into the cloner (PacketCloner), which pushes a copy of the packet into the two passive packet sources (PassivePacketSource) it is connected to.

../../../_images/Cloner.png
network ClonerTutorialStep
{
    @display("bgb=600,300");
    submodules:
        producer: ActivePacketSource {
            @display("p=100,100");
        }
        cloner: PacketCloner {
            @display("p=300,100");
        }
        consumer1: PassivePacketSink {
            @display("p=500,100");
        }
        consumer2: PassivePacketSink {
            @display("p=500,200");
        }
    connections allowunconnected:
        producer.out --> cloner.in;
        cloner.out++ --> consumer1.in;
        cloner.out++ --> consumer2.in;
}
[Config Cloner]
network = ClonerTutorialStep
sim-time-limit = 10s

*.producer.packetLength = 1B
*.producer.productionInterval = 1s