sassir
unread,Oct 23, 2012, 10:12:02 AM10/23/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to omn...@googlegroups.com
Hello all,
I am an student engineer in telecommunications and I am beginner on OMNeT++. In order to learn how to use OMNeT, I followed the TicToc tutorial, I achieved to do it. For a week, i am trying to do the same in wireless; But I have a problem with gate and especially the use of sendDirect.
I get:
<!> Error in module (SimpleHost) Network.host0 (id=2) during network initialization: send()/sendDelayed(): no such gate or gate vector: `out'.
I tried to use your advices of others questions but nothing.
So can anyone help me to understand my fault?
Thanks you very much!!
here is my code (I could not send the files sorry all of you)
////////////File Network.ned:
simple SimpleHost
{
parameters:
@display("i=device/pocketpc_s");
gates:
input in @loose;
}
network Network
{
parameters:
@display("bgi=background/terrain,s;bgb=392,233");
types:
submodules:
host0: SimpleHost {
@display("p=59,84");
}
host1: SimpleHost {
@display("p=351,182");
}
}
//////////////FILE SimpleHost.cc
#include <stdio.h>
#include <string.h>
#include <omnetpp.h>
#include "SimpleHost.h"
Define_Module(SimpleHost);
void SimpleHost::initialize()
{
if (strcmp("host0", getName()) == 0)
{
ev << "I’m host 0, sending initial message" << endl;
cMessage *msg = new cMessage("SimpleMsg");
cModule *targetModule = getParentModule() -- > getSubmodule("host1");
sendDirect(msg, targetModule, "in");
}
}
void SimpleHost::handleMessage(cMessage *msg)
{
ev << "Received message ‘" << msg-> getName() << "’" << endl;
if (strcmp("host0", getName()) == 0)
{
ev << "I’m host 0, sending the message" << endl;
cModule *targetModule = getParentModule() -> getSubmodule("host1");
sendDirect(msg, targetModule, "in");
}
if (strcmp("host1", getName()) == 0)
{
ev << "I’m host 1, sending the message" << endl;
cModule *targetModule = getParentModule() -> getSubmodule("host0");
sendDirect(msg, targetModule, "in");
}
}
///////File SimpleHost.h
#ifndef SIMPLEHOST_H_
#define SIMPLEHOST_H_
#include <stdio.h>
#include <string.h>
#include <omnetpp.h>
class SimpleHost : public cSimpleModule
{
protected:
// The following redefined virtual function holds the algorithm.
virtual void initialize();
virtual void handleMessage(cMessage *msg);
};