Socket API recv

Hi,When I use blocking socket, Can I have the function recv with a timeout? Thus, calling process is blocked for X msec and when time expires, the function returns. Thanks!!

in your case, you should use the select function before calling your receive function. select tells you if any data is available, and it has a timeout.

In your process you can start a new thread which will call a recv function. When recv gets something it will set a ThreadX event. The main process will wait to get the event with a timeout. If timeout passed without getting the event it will exit and you should kill the recv thread. That’s just a way to implement it.