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.

[参考译文] TMDS570LS31HDK:在 tcp_recved 函数中接收较少的数据

Guru**** 2124380 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/577117/tmds570ls31hdk-receiving-less-data-in-tcp_recved-function

器件型号:TMDS570LS31HDK

您好,

在 TCP 客户端中,它成功地将数据发送到服务器,而在响应中,仅接收的数据较少。我使用了 lwip.1.4.1。 我没有在 lwipopt.h、opt.h 中进行任何更改

下面是我在 tcp_recv callbackfunction 中的代码。

clientcallBackReceive (void *arg、struct tcp_pcb *pcb、struct pbuf *p、err_t err)/*用户定义的函数*/ 

char * tempbuffer;
char storeBuffer[600];
void tcp_recved( pcb,p->t_t_len); 
tempbuffer=p->payload;
pbuf_free (p);
strcpy (storeBuffer、tempbuffer);


在此代码中,使用 CCS 中的断点。 我可以观察到 to_len 为366。 但复制到 storeBuffer 的数据仅为201。

请尝试为此建议一些解决方案。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    不确定"更少数据"是什么意思、但请查阅 lwIP wiki 上有关 lwIP 的文档。
    我们在这里不支持 lwIP。

    我可以提出的建议是、我认为您不能保证接收缓冲区被"填满"、而是接收缓冲区的大小更大、但 API 调用会告诉您实际接收到的数据数量、这些数据需要小于或等于缓冲区的大小。