Presumably Resend_Packet_again_Timer.fired() does another send? Why are you waiting instead of just posting a new send()? And are you sure you have enabled ACKS?
Anyway, I'd go look at how you pass the message contents to the resend. It looks like you use "buffer" for something but it points to the sendDone() msg which may not be valid after Done returns. MS moadsofiane wrote: > Hi, > I am checking whether there are packets lost with ack field in the message of > sendDone event. My aim is to retransmit the packet in case of fails (means > the node don't receive an ack). To do this, I try to send the packet lost > after a random time. The problem of this is that the packet retransmitted > still not received. I do the retransmission several times but it still not > successfully received. I don't know why it is not received. I would like to > know how to retransmit the packet that it is not successfully received. > The code of retransmission that I do in sendDone event is as follow: > > event result_t SendBootMsg.sendDone( TOS_MsgPtr pmsg, result_t success ) { > TOS_MsgPtr buffer; > double random; > buffer=pmsg; > > if(pmsg->ack==1){ > dbg(DBG_USR2," Ack=1. No collision\n"); > > }else{ > dbg(DBG_USR2,"Ack=0.Collision\n"); > stat_helo_lost++; > random=((call Random.rand())*1.0 /((uint16_t)- 1));//between 0 an 1 > //dbg(DBG_USR1,"random=%f\n",random); > call Resend_Packet_again_Timer.start(TIMER_ONE_SHOT,random*100*1024);// try > to send it again > > }//ack > }//sendDone > Thank you for your answer, > Best regards, > sofiane > > ____________________________________________________ > > Envie de partager vos photos de vacances ? Voila vous offre 1 Go d’espace de > stockage sur http://macle.voila.fr > > > > > _______________________________________________ > Tinyos-help mailing list > Tinyos-help@millennium.berkeley.edu > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help _______________________________________________ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help