This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

NDK stop receiving

Hello,

i'm using TM4C129 with XDCtool xdctools_3_31_02_38_core and TI-RTOS tirtos_tivac_2_14_00_10.

and there is an attachment which is the modified sample "udpEchoIPv6_DK_TM4C129X_TI_TivaTM4C129XNCZAD" to work on polling stack instead of waiting forever but i faced the following two problems:

1- if it tried to send a UDP packet with no data (data size is zero), then i won't receive anymore even if i tried to send UDP packet with data, the only way to start receiving once again is to reset the code.

2- if i send a UDP packet length, and i called 

s32NumberOfReadyBytes = recvfrom(s,\
pu8ReceivedData,\
MAX_RX_IP_PACKET_SIZE,\
0,\
(struct sockaddr *)&clientAddr,\
&s32FromAddressLength);

then it won't clear the received data from the NDK queue.

3301.udpEchoIPv6_DK_TM4C129X_TI_TivaTM4C129XNCZAD.rar

Thanks,

Mohammed Fawzy

  • Hi Mohammed,

    I went through the modified version of "udpEchoIPv6.c" that you shared and it looks like there is a bug in the second recvFrom() call. Please see my remarks below:

    static void SoAd_vSocketUDPRead(int s)
    {
    
        INT8U                     *pu8ReceivedData = NULL;
        INT32S                     s32NumberOfReadyBytes;
        ...
    
        s32NumberOfReadyBytes = recvfrom(s,\
                                         u8ReceivedData,\
                                         MAX_RX_IP_PACKET_SIZE,\
                                         MSG_PEEK | MSG_DONTWAIT,\
    									 (struct sockaddr *)&clientAddr,\
                                         &s32FromAddressLength);
        ....
        if(s32NumberOfReadyBytes > 0)
        {
    			s32NumberOfReadyBytes = recvfrom(s,\
    											 pu8ReceivedData,\ <-----------puReceivedData is initialized to NULL at
                                                                                                                           the beginning of this function. It should
                                                                                                                           be pointing to a receive buffer.
    											 MAX_RX_IP_PACKET_SIZE,\
    											 0,\
    											 (struct sockaddr *)&clientAddr,\
    											 &s32FromAddressLength);
    			System_printf("Received packet with length %d", s32NumberOfReadyBytes);
    			System_flush();
             ....
        }
    }

    Can you fix this and try ?

    Best,

    Ashish

  • Hi Ashish,

    Thank you for your reply, actually you are right about the bug and this was the cause of the second problem but the first problem still exist.

    Mohammed Fawzy

  • Hi Mohammed,

    Regarding your first problem, receving a UDP packet with no data should be fine. I will have to try creating a similar setup as yours and see if I can reproduce the problem. I will get back to you once I know more.

    Best,
    Ashish