following is the .ned file
simple computer
{
parameters:
gates:
input in1;
output out1;
input in2;
output out2;
}
//
// TODO documentation
//
network Network
{
@display("bgb=538,302");
submodules:
A: computer {
@display("p=30,88");
}
B: computer {
@display("p=344,96");
}
C: computer {
@display("p=209,199");
}
connections:
A.out1 --> B.in1;
B.out1 --> A.in1;
A.out2 --> C.in1;
C.out1 --> A.in2;
C.out2 --> B.in2;
B.out2 --> C.in2;
}
following is .cc source file
#include <string.h>
#include <omnetpp.h>
#include <string>
class computer: public cSimpleModule
{
public:
virtual void initialize();
virtual void handleMessage(cMessage *msg);
};
//----------------------------------------------------------------------
Define_Module(computer);
void computer::initialize()
{
if (strcmp("A", getName()) == 0)
{
send(msg, "out1");
cMessage *copy = (cMessage *) msg->dup();
send(copy, "out2");
}
}
void computer::handleMessage(cMessage *msg)
{
}
Now my question is that in the initialize function node A sends message to B and C. After that i want to send message from node B , FROM NODE B to node A and C. Similarly after that i want to send message from node C to A and B (like distance vector protocol) How can i do that?
Moreover the second question is that how can i send message from all the nodes at the same time to the neighbor nodes i-e A sending message to B,C ; B sending message to A,c ; C sending to A,B. All, A B C sending messages at the same time? Let me make it more brief and clear. A sends message to B as follows
following is .cc source file
#include <string.h>
#include <omnetpp.h>
#include <string>
class computer: public cSimpleModule
{
public:
virtual void initialize();
virtual void handleMessage(cMessage *msg);
};
//----------------------------------------------------------------------
Define_Module(computer);
void computer::initialize()
{
if (strcmp("A", getName()) == 0)
{
send(msg, "out1");
}
}
handleMessage(cMessage *msg) { Now how to send message from C TO A }
A to B C to A?