You can't do that...

send() doesn't have a queue so only the first message will go out.
The rest, until you get a sendDone(), will be ignored. I beleive the
return value from send() indicates whether it was successful.

The way to send as fast as possible is to post the subsequent send()s
from sendDone().

MS

Nilay Chheda wrote:
i am trying to broadcast packets back to back. The problem is that most of the packets are either lost or are not sent at all.
the following is the code snippet.

 result_t  sendData(int dest, uint8_t com)
{
 if (!pending)
      {
    pending = TRUE;
.
.
.

    atomic {
      message->src = TOS_LOCAL_ADDRESS;

      message->dest = dest; // for bcast
      message->com = com; // for JOIN
    }

    for(i=0;i<5; i++)
         {
                     call Send.send(TOS_BCAST_ADDR, sizeof(IntMsg), &data);

          }
.
.

}


 event result_t Send.sendDone(TOS_MsgPtr msg, result_t success)
  {
if (pending && msg == &data)
      {
    pending = FALSE;
      }
return SUCCESS;
  }

Can anybody guide how to avoid packet losses?

Thanks
Nilay





------------------------------------------------------------------------

_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to