FreeRTOS+TCP UDP Socket not blocking forever

Hello,

I’m using a FreeRTOS+TCP UDP socket. According to the documentation of FreeRTOS_recvfrom the default timeout is portMAX_DELAY which should block indefinitely. What I’m actually seeing is after receiving a bunch of packets, then idling for some time it returns -pdFREERTOS_ERRNO_EWOULDBLOCK. I haven’t set any socket options so I find this behavior puzzling and worry there’s something more sinister at play. Does anyone have insight?

Thank you!

The documentation says the default value for ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME is portMAX_DELAY as you mentioned. This value is applied by FreeRTOSIPConfigDefaults.h here if ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME is not defined in your configuration. Can you verify that ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME is not configured in your project?

Maybe you can log the actual blocking time like this:

     #endif /* ipconfigSUPPORT_SIGNALS */
     else
     {
+        FreeRTOS_printf( ( "FreeRTOS_recvfrom: block time = %u \n",
+                         ( unsigned ) pxSocket->xReceiveBlockTime ) );
         lReturn = -pdFREERTOS_ERRNO_EWOULDBLOCK;
         iptraceRECVFROM_TIMEOUT();
     }
}