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 netconn_recv ()超时

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

https://e2e.ti.com/support/tools/code-composer-studio-group/ccs/f/code-composer-studio-forum/1287928/lwip-netconn_recv-timeout

您好!

我运行的是 mcu_plus_sdk_am243x SDK、使用 TCP 服务器示例。

我看到有一个   while ((err = netconn_recv (pClientConn、&buf))= ERR_OK) 就可以正常工作。

我想添加一个超时、因为 网络连接 阻塞、 因此我使用   SYS_TIMEOUT (500、my_timeout_callback、pClientConn);

我收到 错误来自 LWIP_ASSERT_CORE_LOCKED ();

我曾尝试 添加  sys_mutex_lock (&core_lock);  但我没有   core_lock 变量。

请建议如何将超时添加到 网络连接

谢谢。

Eli

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

    您好!

    为了将超时设置为 netconn_recv、在 LwiP-Stack 中定义了以下 API

    /** Set the receive timeout in milliseconds */
    #define netconn_set_recvtimeout(conn, timeout)      ((conn)->recv_timeout = (timeout))

    在函数"45Cb Tcp_Server ()"中,在将 netconn 设置为监听模式之前,可以设置超时(例如, netconn_set_recvtimeout (netconn_name、time_in_ms)、  然后测试 它是否按预期工作。

    此致。
    Shaunak

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

    谢谢!