TI中文支持网
TI专业的中文技术问题搜集分享网站

cc3100 tcp断开后的状态位

请问TI工程师,我在用cc3100实现TCP协议,我的CC3100作server端,PC作client端。我的client端从连接状态断开后,CC3100有没有一个状态位指示已经断开了?如果有的话,这个状态位是什么?谢谢!

Terry Han:

连接断开是和AP断开连接?在回调函数中void SimpleLinkWlanEventHandler(SlWlanEvent_t *pWlanEvent) 中会有断开网络的提示信息

case SL_WLAN_DISCONNECT_EVENT: { slWlanConnectAsyncResponse_t* pEventData = NULL;

CLR_STATUS_BIT(g_ulStatus, STATUS_BIT_CONNECTION); CLR_STATUS_BIT(g_ulStatus, STATUS_BIT_IP_AQUIRED);

pEventData = &pWlanEvent->EventData.STAandP2PModeDisconnected;

// If the user has initiated 'Disconnect' request, //'reason_code' is SL_USER_INITIATED_DISCONNECTION if(SL_USER_INITIATED_DISCONNECTION == pEventData->reason_code) { UART_PRINT("[WLAN EVENT]Device disconnected from the AP: %s," "BSSID: %x:%x:%x:%x:%x:%x on application's request \n\r", g_ucConnectionSSID,g_ucConnectionBSSID[0], g_ucConnectionBSSID[1],g_ucConnectionBSSID[2], g_ucConnectionBSSID[3],g_ucConnectionBSSID[4], g_ucConnectionBSSID[5]); } else { UART_PRINT("[WLAN ERROR]Device disconnected from the AP AP: %s," "BSSID: %x:%x:%x:%x:%x:%x on an ERROR..!! \n\r", g_ucConnectionSSID,g_ucConnectionBSSID[0], g_ucConnectionBSSID[1],g_ucConnectionBSSID[2], g_ucConnectionBSSID[3],g_ucConnectionBSSID[4], g_ucConnectionBSSID[5]); } memset(g_ucConnectionSSID,0,sizeof(g_ucConnectionSSID)); memset(g_ucConnectionBSSID,0,sizeof(g_ucConnectionBSSID)); } break;

Yonghua Pan:

目前CC3100还不会将TCP FIN上传到应用层。所以需要应用层自己去探测。可以用发送数据的方式来探测。

allan chen:

回复 Yonghua Pan:

嗯,我后面就是在发送数据或者接受数据失败的时候重新新建Socket等待连接,实现了断开后能够再次连接的功能,就是不知道这样设计合不合理。

allan chen:

回复 Yonghua Pan:

好的,谢谢~

赞(0)
未经允许不得转载:TI中文支持网 » cc3100 tcp断开后的状态位
分享到: 更多 (0)