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.

[参考译文] lwip 结构 tcp_pcb 声明

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

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/609059/lwip-struct-tcp_pcb-declaration

我已在 TM4C1294XL 开发套件上使用 lwip 创建了 TCP 服务器。 我注意到本论坛和其他地方的大多数示例都创建了全局 tcp_PCB 结构。 阅读 lwip 文件中的注释并检查代码似乎表明我不需要这样做。 tcp_new()看起来像是创建了一个新的 PCB,而 tcp_close()似乎释放了 PCB。

为了查看是否正在使用全局结构、我在建立连接后尝试引用全局 tcp_PCB 结构。 当我尝试发送数据时、我收到一条错误消息、指出连接未连接、这似乎表明连接未被使用。

我缺少什么、还是不需要全局声明 tcp_pcb?

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    我不是 LWIP 专家,但我同意。