How to buffer the data packet in NS2

  • The data packet is buffered during local route repair mechanism in link failure case.During the data communication from source to destination via intermediate routers if link break is detected by the any intermediate node, intermediate node does not send a RERR to the source of the data source node. Instead, it locally repairs the link failure. On such condition, previously arrived packet to the node is buffered without dropping.
  • In the worst situation, each intermediate node cannot repair the break link and cannot find a new route to the destination. In this case the node send route RERR message to source node. The source node broadcasts a RREQ message to find a new route to the destination node. On receiving route reply the node extracts the packet from the buffer and continue the transmission via new path.
  • //on link breakage caserqueue.enque(p); // command of buffer data packet//on the arrival of route replyrqueue.deque(p);