Sending continuous udp messages

Hi 

I am evaluating openthread with NRF52840 and currently I am trying to broadcast continuous udp messages in for loop. But I am facing the issue that cannot be to send more than 80 packets. Please support if anything I missed out., 

static void udp_send(void){

const char buf[] = " 331111796E6F7264696311611111111111111111111111111111111270\0";

otError error = OT_ERROR_NONE;
otError udpSenderror = OT_ERROR_NONE;
otInstance *myInstance = NULL;
otUdpSocket mySocket;
otMessage *test_Message;
otMessageInfo messageInfo;
memset(&messageInfo, 0, sizeof(messageInfo));


myInstance = thread_ot_instance_get();

if(myInstance != NULL)
{
otIp6AddressFromString("ff02::1", &messageInfo.mPeerAddr);
messageInfo.mPeerPort = 1234;

//messageInfo.mIsHostInterface = OT_NETIF_INTERFACE_ID_THREAD;

otIp6AddressFromString("ff03::1\0", &mySocket.mSockName.mAddress);
mySocket.mSockName.mPort = 1994;

error = otUdpOpen(myInstance, &mySocket, NULL, NULL);
//if (error != OT_ERROR_NONE){ break; }

test_Message = otUdpNewMessage(myInstance, NULL);
error = otMessageAppend(test_Message, buf, (uint16_t)strlen(buf));

//if (error != OT_ERROR_NONE){ break; }

udpSenderror = otUdpSend(&mySocket, test_Message, &messageInfo);
error = otUdpClose(&mySocket);

if (udpSenderror != OT_ERROR_NONE && error != OT_ERROR_NONE)
{
otMessageFree(test_Message);
}

}

if (udpSenderror == OT_ERROR_NONE){
NRF_LOG_INFO("udpSend Successful \n");
}else{
NRF_LOG_INFO("udpSend error: %d\r\n", error);
}

}

.....

void main()

{

...

for(int i=0 ;i<80; i++)
{
udp_send();

//nrf_delay_us(1000);
}

...

}

Parents Reply Children
No Data
Related