主题中讨论的其他器件:CC3220SF
您好!
我正在尝试将 http 消息从 CC3220SF HTTP 服务器发送到基于笔记本电脑的 http 客户端、其中 CC3220SF 也用作接入点。 我必须发送大量数据(大约10KB)来响应每个 http 请求。 我尝试发送2kB、每个大小为500B (总共为2kB)的4个片段、这种情况很好、代码如下所示:
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;
}
答案如下:


但是、当我尝试发送更多的片段或/和四个较大尺寸的片段时、它只能作为请求、然后显示404错误、如下所示-
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;
}
Postman 中客户机的响应如下所示(html 页面中出现相同的响应)--


下一个请求发出后、它会在30s 后显示404错误-

有人能帮忙吗?来这里有什么问题?
谢谢、此致、
Kuldeep








