Other Parts Discussed in Thread: CC3200SDK
Hi all.
I am using the CC3200LAUNCHXL.
I invoke function "HTTPPostMethod" every 1 second.
When the count is 100, the function "HTTPCli_sendRequest" in "HTTPPostMethod" return -103.
Help me please.
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.
Other Parts Discussed in Thread: CC3200SDK
Hi all.
I am using the CC3200LAUNCHXL.
I invoke function "HTTPPostMethod" every 1 second.
When the count is 100, the function "HTTPCli_sendRequest" in "HTTPPostMethod" return -103.
Help me please.
Hi Kim,
Is it possible to share some example code with your server to reproduce this at our end.
Regards,
Aashish
Hi Aashish.
while(1) {
osi_MsgQRead(&g_NetQueue, &RecvQue, OSI_WAIT_FOREVER);
if(PUB_MOTOR1_STATUS == RecvQue) {
static int count=0;
lRetVal = HTTPPostMethod(&httpClient[HTTPCLI_SENDACT1], SENDACT1);
if(lRetVal < 0)
{
UART_PRINT("HTTP Container Post failed.\n\r");
}
UART_PRINT("%s : count(%d)\n\r", __FUNCTION__, ++count);
}
}
I am waiting the message "PUB_MOTOR1_STATUS".
And if I get the message, invoke the function "HTTPPostMethod".
If you need more infomation, reply please.
Regares,
Gwanyoung Kim.Hi Aashish.
I tested by other way.
I used "GET" method to restful test site "http://resttesttest.com/".
And I imported the example source "http_client_demo".
I changed some sources as follows,
#define HOST_NAME "httpbin.org"
#define HOST_PORT 80
static int HTTPGetMethod(HTTPCli_Handle httpClient) { long lRetVal = 0; HTTPCli_Field fields[2] = { {HTTPCli_FIELD_NAME_HOST, HOST_NAME}, {NULL, NULL} }; bool moreFlags; /* 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; lRetVal = HTTPCli_sendRequest(httpClient, HTTPCli_METHOD_GET, "/get", moreFlags); if(lRetVal < 0) { UART_PRINT("Failed to send HTTP GET request.\n\r"); return lRetVal; } lRetVal = readResponse(httpClient); return lRetVal; } int main() { long lRetVal = -1; HTTPCli_Struct httpClient; // // Board Initialization // BoardInit(); // // Configure the pinmux settings for the peripherals exercised // PinMuxConfig(); // // Configuring UART // InitTerm(); // // Display banner // DisplayBanner(APP_NAME); InitializeAppVariables(); lRetVal = ConnectToAP(); if(lRetVal < 0) { LOOP_FOREVER(); } lRetVal = ConnectToHTTPServer(&httpClient); if(lRetVal < 0) { LOOP_FOREVER(); } while(1) { int cnt; static int count=0; cnt = 3000000; while(cnt) { cnt--; } UART_PRINT("\n\r"); UART_PRINT("HTTP Get Begin:\n\r"); lRetVal = HTTPGetMethod(&httpClient); if(lRetVal < 0) { UART_PRINT("HTTP Post Get failed.\n\r"); } UART_PRINT("HTTP Get End [%d]:\n\r", count++); UART_PRINT("\n\r"); if(count >= 100) count = 0; // Stop the CC3200 device LOOP_FOREVER(); }
I used SDK version "CC3200SDK_1.1.0".
This source also occur error at 100th request.
Check please.
Regards,
Gwanyoung Kim.
Hi Aashish
Thank you for your advice.
By the way, must I again connect to a http server whenever I request a Restful method?
Regards,
Gwanyoung Kim.
Hi Kim,
Yes you need to re-initiate all steps once you get "connection:close" header filed from server.
Regards,
Aashish