i would like to know how to get the node id where the packet is being processed.
I tried name(), but it doesn't give the id of the node, like the one which is shown in trace file, where the source and destination of the packet hop are shown. In trace file from format() the source and destination are available, but how to access to them , that might also help to know on which node is the current processing is going on.
This is about NS2. Could someone provide some help.
MobileNode *thisnode = (MobileNode *) ((Node::get_node_by_address(id)));
printf("%d\n",thisnode->address());
You can get the id of this node! Try it.
try this:
Node *thisnode = Node::get_node_by_address(id);
printf("%d\n",thisnode->nodeid());
where id is just a number of your node: ex for node(1):
Node *thisnode = Node::get_node_by_address(1)
printf("%d\n",thisnode->nodeid());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With