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/EK-TM4C1294XL:TM4C129 Launchpad TCPecho 示例

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

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/594467/rtos-ek-tm4c1294xl-tm4c129-launchpad-tcpecho-example

器件型号:EK-TM4C1294XL

工具/软件:TI-RTOS

您好!  

我使用 TI RTOS 的 tcpecho 示例来熟悉套接字编程。 代码工作正常。  

我想知道是否可以在代码中知道以太网电缆是否已连接。  

从我看到的情况来看、代码流不会进入下面给出的 while 循环:

while ((clientfd =
接受(server、(struct sockadr *)&clientAddr、&addrlen)!=-1){

system_printf ("tcpHandler:创建线程 clientfd =%d\n"、clientfd);

/* Init the Error_Block */
ERROR_INIT (&EB);

/*初始化默认值并设置参数。 *
Task_Params_init (&taskParams);
taskParams.arg0 =(UArg) clientfd;
taskParams.STACKSIZE = 1280;
taskHandle = Task_create ((Task_FuncPtr) tcpWorker、&taskParams、&EB);
if (taskHandle == NULL){
System_printf ("错误:创建新任务失败\n");
close (clientfd);

/* addrlen 是一个值结果参数,必须重置为下一个接受呼叫*/
addrlen = sizeof (clientAddr);

是否有任何其他方法可以知道以太网电缆是否已连接到代码中?

此致

Praveen

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    此主题可能有助于:
    "e2e.ti.com/.../498224 以太网电缆已连接"
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    Bob、您好!

    以上链接答案对我来说是可行的。
    谢谢你。