HI,
I am using CC3100 for communicating with a TCP server. I have proprietary protocol that I am using for communication. The size of data transfer varies depending on the protocol frame type. Here the communication is asynchronous, means client or server can send packets at any time. Below is the sequence I have used for communication with server
1. Open the socket (sl_Socket)
2. Connect to the server (sl_Connect)
3. If data need to be send to server, send using sl_Send
4. Receive data using sl_Recv
I have some queries regarding the usage of sl_Recv API as shown below.
*************************If the socket is in Blocking mode *********************
In blocking mode (without timeout), the sl_Recv function will return only if the data is received. Here my doubt is, data is received in serial manner (byte_0, byte_1, byte_2........byte_n). Whether the sl_Recv returns immediately after getting the byte_0 or wait till complete packet got received? In sl_Recv API there is a parameter for specifying the data buffer length. Why it is required? Does it mean that the sl_Recv returns only after receiving as much bytes as specified by the data length?
*************************If the socket is in Non-Blocking mode *********************
In non-blocking mode we will get SL_EAGAIN if there is no data. What will be the behavior, as explained above for blocking mode