Hello, I am developing a distributed system in ns-2, where mobile nodes run a pthreaded application (lets call it app) that is able to talk to the routing agent directly and broadcast or unicast packets on demand.
The app can successfully start an ragent's timer to broadcast beacon packets at some interval. That works. The problem appears when I want the app to call the ragent's function to broadcast or unicast a packet to a specific destination. The function creates a new control packet, sets values to the CMN, IP and routing protocol's headers and then: Scheduler::instance().schedule(ragent_->target_, p, 0.1); This (most of the times) fails with: ns: scheduler going backwards in time from 12.560000 to 12.550000. I don't understand why, as it is the ragent that pushes packet events to the scheduler, similar to the beacon example with the timer. I understand that the app is not synchronized with the rest of the simulator, but.. as it just makes a call to the ragent, shouldn't the latter able to handle the situation and set the times correctly? Do you have any ideas on how to solve the problem? I am using Heap Scheduler/ns-2.35. Many thanks in advance, Alex