Other Parts Discussed in Thread: CC3100, CC3100SDK
I have been working on experimenting using MSP430F5529LP and CC3100Boost wifi Boosterpack to develop a Low Power IOT device. The experiment platform connects to a server and successfully exchanges data. I am using restful API for communication/data exchange as well as TLS for security. I am also using Texas Instruments simplelink software platform for development. I am using GET Method to communicate with the server. Where I am stuck is when I executed the following command with a string length of more than 111 characters. (Note: Code snippet is modification for Http_Client example). str is string variable with the restful command.
strcat(str,str2);
/* Set request header fields to be send for HTTP request. */
HTTPCli_setRequestFields(httpClient, fields);
/* Send GET method request. */
/* Here we are setting moreFlags = 0 as there are no more header fields
need to send
at later stage. Please refer HTTP Library API documentaion @
HTTPCli_sendRequest for more information.
*/
moreFlags = 0;
retVal = HTTPCli_sendRequest(httpClient, HTTPCli_METHOD_GET, (const char *) str, moreFlags);
if(retVal < 0)
{
CLI_Write(" Failed to send HTTP GET request.\n\r");
return retVal;
}
sprintf((char *)tmpBuf, "%d", (sizeof(str)-1));
/*
Here we are setting lastFlag = 1 as it is last header field. Please refer
HTTP Library API documentaion @ref HTTPCli_sendField for more information.
*/
lastFlag = 1;
retVal = HTTPCli_sendField(httpClient, HTTPCli_FIELD_NAME_CONTENT_LENGTH, (char *)tmpBuf, lastFlag);
if(retVal < 0)
{
CLI_Write(" Failed to send HTTP GET request header.\n\r");
return retVal;
}
retVal = readResponse(httpClient);
// Send GET data/body
retVal = HTTPCli_sendRequestBody(httpClient, (const char *) str, (sizeof(str)-1));
if(retVal < 0)
{
CLI_Write(" Failed to send HTTP GET request body.\n\r");
return retVal;
}
retVal = readResponse(httpClient);
return retVal;
As state aboue if str string length is more than 111 characters, upon execution of “HTTPCli_sendRequest” the function returns and error code of HTTPCli_ESENDBUFSMALL (-107). Following are additional details for the error from HTTPCli_ESENDBUFSMALL.
/#define HTTPCli_ESENDBUFSMALL (-107)
Internal send buffer is not big enough.
Modify the SEND_BUFLEN macro in the httpcli.c and rebuild the library if needed.
Following a code snippet from httpcli.c
/* Configurable lengths */ #define CONTENT_BUFLEN 128 #define URI_BUFLEN 128 #define SEND_BUFLEN 128 #define MAX_FIELD_NAME_LEN 24
I tried to change SEND_BUFLEN to 256, but I still encountered errors. So I am thinking there might be one of two possible paths moving forward
- Update the buffer lengths as appropriate
- Break the date packets into to many 128 byte groups.
Appreciate if someone could share thoughts on how to move forward.