hello, if I understand correctly , you want to do like what has done in back off time. for it you should define timehandler function and use a variable from this function then you should useresched or sched receive function to save time and after specific time , timeout() function will call so you can define what you want to do after this period in timeout function. like below example: void UCBAgent::newTimer() { hdr_ucb* flood; double delay = Random::uniform(minDelay_, maxDelay_); // Create a new packet if ( !rebroadcast_ ) { rebroadcast_ = allocpkt(); } flood = hdr_ucb::access( rebroadcast_ ); flood->msg_src = myID_; flood->total_store_time = 0; flood->total_store_time+= delay; delsnd_timer_.resched( delay ); // after delay time , timeout() function will call } void UCBAgent::timeout() { if ( rebroadcast_ ) { send( rebroadcast_, 0 ); } }
I hope it will be helpful. regards From: sony Jose <vimalajo...@gmail.com> To: ns-users@ISI.EDU Sent: Sunday, June 30, 2013 9:23 PM Subject: [ns] Fwd: How to set a timer to check condition in recvRequest() Hi everyone, As a part of my project in MANETs, I have added an entry named Flag 1 in the existing neighbor table in aodv. Whenever a node X receive a request from node Y, Flag 1 corresponding to will get set as "1". Actually this flag has to be set if the RREQ send by X reaches X itself via rebroadcast from its neighbors, within a certain time period. How can I check this condition? Is there any way to store the time at which the RREQ packet has been send first and we can make use of that from recvRequest() function? In the recvRequest() i am able to print the node from which the RREQ is received. But how can I check that if the received RREQ is the one actually send by node X and has obtained by it within a timeout? I want this checking since I have to make sure that all the neighbors are responding. Can anyone please help me with this. Thanks for y.our valuable time Regards, Sony