This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC3220SF-LAUNCHXL: TCP Client non-blocking socket best practics

Part Number: CC3220SF-LAUNCHXL
Other Parts Discussed in Thread: CC3220SF

Hi all,

I've started to use CC3220SF launch pad, trying to set a TCP Client connection to a local server. I'm using the network terminal examples, and checking the code about the TCP Client, I found that when the user start a  "recv" command selecting client mode , the socket is created inside the TCPClient function (socket_cmd.c) and destroyed before exiting the function. Instead, I need to start a connection from my cc3220 to the server and keep it alive until I need, setting furthermore a callback function when data is sent to cc3220 by the server, in short words I need async send and receive without blocking the MCU waiting for incoming data. In the past I done this using TIVA processor without TI-RTOS (in that specific case, I start a server on the TIVA, setting the callback function on data rx).

Which is the best practis to achive what I need?

thanks!

Riccardo

P.S My final target is develop a web socket connection where my CC3220 will be the client.

  • Riccardo,

    You could do the following:

    while you wait for the response, in the rcv function you could do a usleep() function which would allow another task to run. You can then create a new task and do something else.

    Another Idea would be to work from the OoB example, and implement your own recv task that waits for a packet to be received.


    Regards,

    VR
  • Hi Vincent,

    In the your first suggestion you mean use a blocking socket running in a different task ? Blocking sockets allow MCU to go into sleep while waiting for incoming data?

  • Riccardo,

    usleep() only blocks the task its in from running for a certain duration. The MCU could then be run a lower priority task during the time the Recv function is sleeping.

    Regards,

    VR