Help! How to divide a packet(msg or job) and then send to multiple destinations

18 views
Skip to first unread message

Muhammad Haris

unread,
Jun 5, 2021, 1:46:37 AM6/5/21
to OMNeT++ Users
Hi,

My scenario is :
node 0 send a packet(could be a msg or job) to node 1, Now node 1 divides it into 3 parts and distributes those parts among node 2, node 3, and node 4. and the same for responses back to node 0

Likewise, fifo example in omnetpp generator sends a message to FIFO and FIFO schedule it to sink node, Similarly, I want to generator send message to FIFO, which divide and schedule it to multiple nodes.

is it possible in omnetpp?
if yes please guide me As I am new with omnetpp
Regards 

Alfonso Ariza Quintana

unread,
Jun 6, 2021, 5:54:15 AM6/6/21
to omn...@googlegroups.com

 

 

Yes, you can. I suppose that you are using a cPacket and you will use bytes, and your parameter is the maximum fragment size.

 

packet MyPacket {

int destAddr = -1; // destination address

int srcAddr = -1; // source address

int seqNumber = -1;

int fagment = -1; // time to live

int totalFragments = -1;

}

 

I have included 3 parameters to check the fragmentation and to detect if some packet is lost, the seqNumber helps to detect duplicated

 

auto len = pkt->getByteLength();

 

int numFrag = ceil((double)len/(double)fragSize);

if (numFrag > 1) {

    for (int i = 0; i < numFrag; i++) {

       auto pktAux = pkt->dup();

       if (i < numFrag -1)

             pktAux -> setByteLength(fragSize);

       else

             pktAux -> setByteLength(len);

       pktAux->setFragment(i);

       pktAux->setTotalFragments(numFrag);

       len -= fragSize;

       send(pktAux, “out” );

    }

   delete pkt;

}

else {

    // no frament

    send(pkt, “out” );

}

 

 

Enviado desde Correo para Windows 10

--
You received this message because you are subscribed to the Google Groups "OMNeT++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to omnetpp+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/omnetpp/3e9d4437-f382-4874-bc62-7ba96df46395n%40googlegroups.com.

 

Muhammad Haris

unread,
Jun 8, 2021, 12:34:37 AM6/8/21
to omn...@googlegroups.com
thank you sir for your response.
 
as I am new with omnetpp, is there any tutorial that would help me in implementing the above scenario....?



Mailtrack Sender notified by
Mailtrack 06/08/21, 09:33:41 AM

Reply all
Reply to author
Forward
0 new messages