对于Ieee80211
INet库中的特殊问题,我有一个疑问,当在多个站点之间发送cPacket
/时会发生什么cMessage
。
这可能不完全与INet有关,而是与OmNet ++的一般行为有关。这是问题:
发送
cPacket
/时cMessage
,它被多个站/模块接收,是否复制了它?还是所有接收者都获得了指向同一实例的指针?
因此,在这样的网络中:
Station A
is sending a cMessage
which is received by all the other stations. Of course only one station is the receiver, everyone else will drop the packet. So if B
is the receiver and C
, D
, E
and F
go:
void handleMessage(cMessage *msg) {
if (this->isNotForUs())
delete msg;
}
Will it cause B
to have its frame destroyed?
In OMNeT++/INET
sending a cMessage
to multiple receivers is modelled by creating multiple copies of this message and sending one copy to one receiver. There is dup()
method that creates an exact copy of the message. For example:
cMessage *msg2 = msg->dup();
结果,每个接收者都会收到一个新的cMessage
对象实例,并且它可以以任何方式删除或处理它。因此,在你的榜样删除的消息C
,D
,E
,并且F
不影响所收到的消息B
。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句