Trying to send a message in Broadcast manner with tictoc omnet++

68 views
Skip to first unread message

Qazi Ibrahim

unread,
Nov 26, 2019, 4:29:32 PM11/26/19
to OMNeT++ Users
create a tictoc that can
  1.  sending multiple copies of data in a large network0 at time to all conneted nodes(?????) 
  2.  that do not go for infinity: (tictoc10)
  3.  all node/tic tocs should receives and drop packets after some time :(tictoc-9) 
  4.  their must be source and destination : (tictioc-14)

my current status:
  • i cant send message to multiple "TXC"/Nodes..
  • i have made TXC14 as my base code and i am making changes in their ..
  • i have also tried to stop infinite loop with sender..
  • also is am trying this with Grid Topology
  • but i can understand how to handle message this..
  • their some constraints from NED  that cant understand like 
  • submodules:
  •         tic[20]: Txc14;

void Txc14::forwardMessage(TicTocMsg14 *msg)
{

    int n = gateSize("gate$o");
    int k = intuniform(0,n-1);

    cGate *arrivalGate = msg->getArrivalGate();
    if (arrivalGate == NULL) //self-message, do what?
    {
        msg->setHopCount(msg->getHopCount()+1);
        EV << "Forwarding self message " << msg << " on port out[" << k << "]\n";
       send(msg, "gate$o", k);
    }
    else if (arrivalGate != NULL)   
  {.
        msg->setHopCount(msg->getHopCount()+1);

        int arrivalGateIndex = arrivalGate->getIndex();

        if (n >= 2) //if out gates are more than 1, easy
        {
           while (arrivalGateIndex == k
          {
                k = intuniform(0,n-1);
            }
        }

        EV << "Forwarding message " << msg << " on port out[" << k << "]\n";
        send(msg, "gate$o", k);
    }
}


void Txc14::handleMessage(cMessage *msg)
{
    TicTocMsg14 *ttmsg = check_and_cast<TicTocMsg14 *>(msg);

    if (ttmsg->getDestination() == getIndex()) {
        int hopcount = ttmsg->getHopCount();
        EV << "Message " << ttmsg << " arrived after " << hopcount << " hops.\n";
        numReceived++;
        bubble("ARRIVED, starting new one!");
        delete ttmsg;

       /** EV << "Generating another message: ";
        TicTocMsg14 *newmsg = generateMessage();
        EV << newmsg << endl;
        forwardMessage(newmsg);
        numSent++;
        **/
    }
    else {
        forwardMessage(ttmsg);
        bubble("not here!");

    }
}
Reply all
Reply to author
Forward
0 new messages