如何在 NS2 中查找节点 ID
How to find node id in NS2?
我想知道如何获取正在处理数据包的节点ID。
我尝试了 name(),但它没有给出节点的 id,就像跟踪文件中显示的那样,其中显示了数据包跃点的源和目标。在 format() 的跟踪文件中,源和目标可用,但如何访问它们,这也可能有助于了解当前处理在哪个节点上进行。
这是关于 NS2 的。有人可以提供一些帮助。
MobileNode *thisnode = (MobileNode *) ((Node::get_node_by_address(id)));
printf("%dn",thisnode->address());
你可以得到这个节点的id!试试吧。
试试这个:
Node *thisnode = Node::get_node_by_address(id);
printf("%dn",thisnode->nodeid());
其中 id 只是节点的数字:例如,节点(1):
Node *thisnode = Node::get_node_by_address(1)
printf("%dn",thisnode->nodeid());
相关文章:
- A*路径查找-如何有效地更新openNodes优先级队列中的节点值
- N-Ary 树 C++ - 如何查找节点的级别
- 在由邻接列表表示的树中查找节点到另一个给定节点之间的路径
- 用于在链表中查找节点的算法
- 查找树中两个节点之间的最大成本边
- 查找树(不属于任何特定类型的简单连接树)中两个节点之间的路径
- 沿着路径查找节点数量
- 在 n 元树 c++ 中查找给定节点的祖先
- C++ 查找无序树中具有最高值的节点
- 查找二叉树的父节点函数
- 在 C 语言的链表中查找最小的两个节点
- 在从通用树转换的二进制树中查找节点的父
- 在具有任意数量子级的节点树中查找节点
- 如何在 NS2 中查找节点 ID
- 查找节点崩溃的函数
- 递归查找节点函数
- 查找节点树的最大路径和
- 使用 Dijkstra 和最小堆 c++ 查找节点之间的最短路径
- 遍历查找节点中的顶点并返回索引
- c++如何在树上添加/查找节点??:/.