# FreeRTOS\_recv priority and tasks

**URL:** <https://forums.freertos.org/t/freertos-recv-priority-and-tasks/7870>\
**Category:** Kernel\
**Created:** [May 23, 2019, 1:39pm UTC](https://forums.freertos.org/t/freertos-recv-priority-and-tasks/7870 "2019-05-23T13:39:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [May 23, 2019, 1:39pm UTC](https://forums.freertos.org/t/freertos-recv-priority-and-tasks/7870/1 "2019-05-23T13:39:57Z")

</div>

**[friesen](https://sourceforge.net/u/friesen/)** wrote on [Thursday, May 23, 2019](https://sourceforge.net/p/freertos/discussion/382005/thread/b0619d2ac2/#5198):

I have a situation where it would appear that recv is blocking lower priority tasks from running. The FREERTOS + TCP network tasks is priority 2, and the FreeRTOS\_recv calling task is priority 2, and priority 1 tasks don’t seem to be getting called when network connectivity is poor and the recv timeout has not been reached. What types of situations could cause this scenario, and how might one fix this issue?

---

<div class="post-metadata">

**Author:** ![htibosch](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/htibosch/32/62_2.png) [@htibosch](https://forums.freertos.org/u/htibosch)\
**Post date:** [May 23, 2019, 2:13pm UTC](https://forums.freertos.org/t/freertos-recv-priority-and-tasks/7870/2 "2019-05-23T14:13:57Z")

</div>

**[heinbali01](https://sourceforge.net/u/heinbali01/)** wrote on [Thursday, May 23, 2019](https://sourceforge.net/p/freertos/discussion/382005/thread/b0619d2ac2/#0515):

Erik, from experience, it is recommended to assign the following priorities in a FreeRTOS+TCP project:

- Highest : the Network Interface driver (`niEMAC_HANDLER_TASK_PRIORITY`)
- Medium : the IP-task (`ipconfigIP_TASK_PRIORITY`)
- Lower : the tasks that make use of FreeRTOS+TCP

You are free to assign any priority to other tasks that are not using TCP/IP.

PS. the #define `niEMAC_HANDLER_TASK_PRIORITY` may not be used as such in all drivers. Please check your `NetworkInterface.c`, and look for `xTaskCreate()`.

What time-out is being used when you call `FreeRTOS_recv()`?  
This is the value of `ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME`, unless you set it specifically with the socket option `FREERTOS_SO_RCVTIMEO`.

Can you verify that the function does block for longer periods of time?

The IP-task blocks on a call to `xQueueReceive()`.

Your priority 1 task will run as long as the high-priority tasks are in a blocked state.

But maybe your problem gets solved if you assign the recommended priorities.
