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.

[参考译文] RTOS/TM4C1294NCPDT:检测网络通信中的插座断开

Guru**** 2578945 points
Other Parts Discussed in Thread: TM4C1294NCPDT

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

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/771037/rtos-tm4c1294ncpdt-detection-of-socket-disconnection-in-network-communication

器件型号:TM4C1294NCPDT

工具/软件:TI-RTOS

您好!  

我使用带有 TM4C1294NCPDT 微控制器的定制板作为客户端、并且在计算机上运行单独的服务器。   

我创建了 TCP/IP 套接字、如下所示: sock = socket (AF_iNet、sock_stream、0);我在其中侦听服务器。

我使用以下 API 从服务器 recv (sock、recv_buf、MES_MAX_READ_buff、MSG_DONTWAIT)接收数据。 我正在使用 MSG_DONTWAIT 标志使函数不分块。 这是使 recv 函数非阻塞的正确标志吗?

此外、如果套接字连接断开、如何检测它?