Continuous execution of a Task

hello @aggarg ,
Thanks for the prompt response. I referred to the link you provided. It gave me some clarity, however, I’m still struggling resolving my issue and understanding the code that you shared.
While I compared my code with your recommendation, I could find the following (pl. note that I’m writing code for UDP send and receive application):

  1. I created a socket (return value indicated socket created successfully)
  2. asked it to bind to any address (return value indicated socket bound successfully)
  3. Connect to the Address specified.
  4. start sending data. Also listen to the data being received on the same socket (as my STA was also transmitting).

I also referred to listen command. As i could make out, it is for TCP kind of connections (is this understanding correct?).

Also, I tried one more thing. I created a queue to push the data and then pulled the same inside socket task. At this time also, the task execution stopped abruptly. It returned to the main thread while(1) statement. I tried using various hooks like MallocFailedHook, StackOverflowHook, IdleHook etc to debug the issue. But this also did not help. While normal execution was going on, it abruptly returned to the mainThread while(1) statement and stayed there only. Normally task function shall never return, but mine did!!

Please let me know if you need any further details from my end!

BR,
H C Trivedi