opnet之error

Packet pointer references unowned packet(0)

  • 错误实例1:
Packet* data;
data = op_subq_pk_access (0, 0);

op_pk_send(data,OUT_STRM);
printf("send 1\n");

op_pk_send(data,OUT_STRM);
printf("send 2\n");
  • 错误实例2:
Packet* data1;
Packet* data2;

data1 = op_subq_pk_access (0, 0);
op_pk_send(data1,OUT_STRM);
printf("send 1\n");

data2 = op_subq_pk_access (0, 0);
op_pk_send(data2,OUT_STRM);
printf("send 2\n");

A packet is an object that can be owned by one entity at any given time. A module gains ownership of a packet when it creates the packet (e.g., op_pk_create ()) or gets a packet (e.g., op_pk_get ()). When a packet is sent (e.g., op_pk_send ()) or destroyed (e.g., op_pk_destroy()), the module no longer owns the packet. If you attempt to manipulate a packet pointer that has already been sent or destroyed, you will obtain this error message.

Verify the following if you get this error:

  • Are you attempting to manipulate a packet pointer for a packet that has already been sent, or already destroyed?
  • Are you trying to use a packet pointer for a packet that has never been created or obtained using op_pk_get(), etc.?

For a full discussion on packet ownership, please refer to the help section Modeling Concepts -> Communication Mechanisms -> Packet-Based Communications -> General Properties of Packets.

lmz:

  • 每一个包都有一个ID,尽管可以同时为一个包获取多个包指针,但是指向的都是同一个包。
  • 对于已经不再拥有的包,不可以执行send和destroy操作,但是仍然可以执行acess和remove操作。
Packet* data1;
Packet* data2;

data1 = op_subq_pk_access (0, 0);
op_pk_send(data1,OUT_STRM);
printf("send 1\n");

data2 = op_subq_pk_access (0, 0);
printf("access ok\n");
op_subq_pk_remove (0, 0);
printf("remove ok\n");
op_pk_send(data2,OUT_STRM);
printf("send 2\n");

这里写图片描述

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值