Other Parts Discussed in Thread: CC3220SF
Hi,
I am trying to send the http message from CC3220SF Http Server to a Laptop based http client where CC3220SF also working as access point. I have to send huge data (approx 10kB) in response for each http request. I tried sending 2kB with 4 fragments of each size 500B (total 2kB) which is working fine and the code is as below -
int32_t dataGetCallback(uint8_t requestIdx, uint8_t *argcCallback, uint8_t **argvCallback, SlNetAppRequest_t *netAppRequest) { uint8_t *pPayload; uint16_t metadataLen, sendDatalen; char sendDataStr1[500] = "1Machine learning (ML) is a field of inquiry devoted to understanding and building methods that 'learn', that is, methods that leverage data to improve performance on some set of tasks. It is seen as a part of artificial intelligence. Machine learning algorithms build a model based on sample data, known as training data, in order to make predictions or decisions without being explicitly programmed to do so1."; char sendDataStr2[500] = "2Machine learning (ML) is a field of inquiry devoted to understanding and building methods that 'learn', that is, methods that leverage data to improve performance on some set of tasks. It is seen as a part of artificial intelligence. Machine learning algorithms build a model based on sample data, known as training data, in order to make predictions or decisions without being explicitly programmed to do so2."; char sendDataStr3[500] = "3Machine learning (ML) is a field of inquiry devoted to understanding and building methods that 'learn', that is, methods that leverage data to improve performance on some set of tasks. It is seen as a part of artificial intelligence. Machine learning algorithms build a model based on sample data, known as training data, in order to make predictions or decisions without being explicitly programmed to do so3."; char sendDataStr4[500] = "4Machine learning (ML) is a field of inquiry devoted to understanding and building methods that 'learn', that is, methods that leverage data to improve performance on some set of tasks. It is seen as a part of artificial intelligence. Machine learning algorithms build a model based on sample data, known as training data, in order to make predictions or decisions without being explicitly programmed to do so4."; char sendDataStr5[500] = "4Machine learning (ML) is a field of inquiry devoted to understanding and building methods that 'learn', that is, methods that leverage data to improve performance on some set of tasks. It is seen as a part of artificial intelligence. Machine learning algorithms build a model based on sample data, known as training data, in order to make predictions or decisions without being explicitly programmed to do so5."; pPayload = gPayloadBuffer; sl_Memcpy (pPayload, sendDataStr1, sizeof(sendDataStr1)); pPayload += sizeof(sendDataStr1); /* NULL terminate the payload */ *(pPayload) = '\0'; sendDatalen = sizeof(sendDataStr1) + sizeof(sendDataStr2) + sizeof(sendDataStr3)+ sizeof(sendDataStr4); //+sizeof(sendDataStr5); metadataLen = prepareGetMetadata(0, sendDatalen, HttpContentTypeList_TextPlain); pthread_mutex_lock(&spiMutex); sl_NetAppSend (netAppRequest->Handle, metadataLen, gMetadataBuffer, (SL_NETAPP_REQUEST_RESPONSE_FLAGS_CONTINUATION | SL_NETAPP_REQUEST_RESPONSE_FLAGS_METADATA)); sl_NetAppSend (netAppRequest->Handle,sizeof(sendDataStr1), gPayloadBuffer, SL_NETAPP_REQUEST_RESPONSE_FLAGS_CONTINUATION); /* mark as last segment */ pPayload = gPayloadBuffer; sl_Memcpy (pPayload, sendDataStr2, sizeof(sendDataStr2)); pPayload += sizeof(sendDataStr2); /* NULL terminate the payload */ *(pPayload) = '\0'; sl_NetAppSend (netAppRequest->Handle,sizeof(sendDataStr3), gPayloadBuffer, SL_NETAPP_REQUEST_RESPONSE_FLAGS_CONTINUATION); /* mark as last segment */ pPayload = gPayloadBuffer; sl_Memcpy (pPayload, sendDataStr3, sizeof(sendDataStr3)); pPayload += sizeof(sendDataStr3); /* NULL terminate the payload */ *(pPayload) = '\0'; sl_NetAppSend (netAppRequest->Handle,sizeof(sendDataStr3), gPayloadBuffer, SL_NETAPP_REQUEST_RESPONSE_FLAGS_CONTINUATION); /* mark as last segment */ pPayload = gPayloadBuffer; sl_Memcpy (pPayload, sendDataStr4, sizeof(sendDataStr4)); pPayload += sizeof(sendDataStr4); /* NULL terminate the payload */ *(pPayload) = '\0'; sl_NetAppSend (netAppRequest->Handle,sizeof(sendDataStr4), gPayloadBuffer, 0); /* mark as last segment */ pthread_mutex_unlock(&spiMutex); return 0; }
The response is as below -
But when I try sending more fragments or/and four fragments with larger size it stuck is the request only and then show 404 error as shown below -
int32_t dataGetCallback(uint8_t requestIdx, uint8_t *argcCallback, uint8_t **argvCallback, SlNetAppRequest_t *netAppRequest) { uint8_t *pPayload; uint16_t metadataLen, sendDatalen; char sendDataStr1[500] = "1Machine learning (ML) is a field of inquiry devoted to understanding and building methods that 'learn', that is, methods that leverage data to improve performance on some set of tasks. It is seen as a part of artificial intelligence. Machine learning algorithms build a model based on sample data, known as training data, in order to make predictions or decisions without being explicitly programmed to do so1."; char sendDataStr2[500] = "2Machine learning (ML) is a field of inquiry devoted to understanding and building methods that 'learn', that is, methods that leverage data to improve performance on some set of tasks. It is seen as a part of artificial intelligence. Machine learning algorithms build a model based on sample data, known as training data, in order to make predictions or decisions without being explicitly programmed to do so2."; char sendDataStr3[500] = "3Machine learning (ML) is a field of inquiry devoted to understanding and building methods that 'learn', that is, methods that leverage data to improve performance on some set of tasks. It is seen as a part of artificial intelligence. Machine learning algorithms build a model based on sample data, known as training data, in order to make predictions or decisions without being explicitly programmed to do so3."; char sendDataStr4[500] = "4Machine learning (ML) is a field of inquiry devoted to understanding and building methods that 'learn', that is, methods that leverage data to improve performance on some set of tasks. It is seen as a part of artificial intelligence. Machine learning algorithms build a model based on sample data, known as training data, in order to make predictions or decisions without being explicitly programmed to do so4."; char sendDataStr5[500] = "4Machine learning (ML) is a field of inquiry devoted to understanding and building methods that 'learn', that is, methods that leverage data to improve performance on some set of tasks. It is seen as a part of artificial intelligence. Machine learning algorithms build a model based on sample data, known as training data, in order to make predictions or decisions without being explicitly programmed to do so5."; pPayload = gPayloadBuffer; sl_Memcpy (pPayload, sendDataStr1, sizeof(sendDataStr1)); pPayload += sizeof(sendDataStr1); // /* NULL terminate the payload */ *(pPayload) = '\0'; sendDatalen = sizeof(sendDataStr1) + sizeof(sendDataStr2) + sizeof(sendDataStr3)+ sizeof(sendDataStr4)+sizeof(sendDataStr5); metadataLen = prepareGetMetadata(0, sendDatalen, HttpContentTypeList_TextPlain); pthread_mutex_lock(&spiMutex); sl_NetAppSend (netAppRequest->Handle, metadataLen, gMetadataBuffer, (SL_NETAPP_REQUEST_RESPONSE_FLAGS_CONTINUATION | SL_NETAPP_REQUEST_RESPONSE_FLAGS_METADATA)); sl_NetAppSend (netAppRequest->Handle,sizeof(sendDataStr1), gPayloadBuffer, SL_NETAPP_REQUEST_RESPONSE_FLAGS_CONTINUATION); /* mark as last segment */ pPayload = gPayloadBuffer; sl_Memcpy (pPayload, sendDataStr2, sizeof(sendDataStr2)); pPayload += sizeof(sendDataStr2); // /* NULL terminate the payload */ *(pPayload) = '\0'; sl_NetAppSend (netAppRequest->Handle,sizeof(sendDataStr3), gPayloadBuffer, SL_NETAPP_REQUEST_RESPONSE_FLAGS_CONTINUATION); /* mark as last segment */ pPayload = gPayloadBuffer; sl_Memcpy (pPayload, sendDataStr3, sizeof(sendDataStr3)); pPayload += sizeof(sendDataStr3); // /* NULL terminate the payload */ *(pPayload) = '\0'; sl_NetAppSend (netAppRequest->Handle,sizeof(sendDataStr3), gPayloadBuffer, SL_NETAPP_REQUEST_RESPONSE_FLAGS_CONTINUATION); /* mark as last segment */ pPayload = gPayloadBuffer; sl_Memcpy (pPayload, sendDataStr4, sizeof(sendDataStr4)); pPayload += sizeof(sendDataStr4); //// /* NULL terminate the payload */ *(pPayload) = '\0'; sl_NetAppSend (netAppRequest->Handle,sizeof(sendDataStr4), gPayloadBuffer, SL_NETAPP_REQUEST_RESPONSE_FLAGS_CONTINUATION); /* mark as last segment */ pPayload = gPayloadBuffer; sl_Memcpy (pPayload, sendDataStr5, sizeof(sendDataStr5)); pPayload += sizeof(sendDataStr5); //// /* NULL terminate the payload */ *(pPayload) = '\0'; sl_NetAppSend (netAppRequest->Handle,sizeof(sendDataStr5), gPayloadBuffer, 0); /* mark as last segment */ pthread_mutex_unlock(&spiMutex); return 0; }
The response of the client in Postman is shown below (same response occurred in html page) --
When the next request is placed then it shows 404 error after 30 s -
Can anyone help, whats wrong going here?
Thanks & Regards,
Kuldeep