Hi,
Multiple tasks are communicating with lwIP at the same time.
Each task sets lwip_setsockopt() to handle response timeout.
> struct timeval tv;
> tv.tv_sec = RECV_TIMEOUT_MSEC / 1000;
> tv.tv_usec = (RECV_TIMEOUT_MSEC % 1000) * 1000;
> lwip_setsockopt(sockfd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
Each task uses lwip_recv(), lwip_recvfrom(), and lwip_select() to receive data, but timeouts cannot be determined from the return values.
For single task, I can determine timeout by checking errno.
However, since errno is a common global variable, in the case of multitasking, it is not guaranteed which task the result is.
In order to maintain errno for each task, is there no other way than to prepare errno for the number of tasks and modify all the places where errno is set?
I appreciate your help.
Solved! Go to Solution.
Hi @atm2024,
I'm afraid there isn't really another proper way of doing this. I would recommend you try using this method, and let us know if you experience further issues.
BR,
Edwin.
Hi @atm2024,
I'm afraid there isn't really another proper way of doing this. I would recommend you try using this method, and let us know if you experience further issues.
BR,
Edwin.