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.

关于SOCKET连接数量的问题

Other Parts Discussed in Thread: CC3200

我用CC3200模块做TCP SERVER时,用一个数组(80个字节)去保存客户端连接SOCKET ID ,TCP客户端反复断开、连接,大概7次以后无法再连接。分析是达到socket连接限制。于是,想到周期性去轮询往数组中保存有客户端连接的SOCKET ID发送一包数据,3次发送不成功就close掉该客户端SOCKET ID。测试发现客户端断开、连接次数确实比7次多。但多次以后最终每次都会卡死在下面标色的位置。以致无法再连接socket,请问是什么问题?对于SOCKET连接数量限制问题有什么其他解决方案?

sl_Accept(int sd, SlSockAddr_t *addr, SlSocklen_t *addrlen)
{
_SlSockAcceptMsg_u Msg;
_SlReturnVal_t RetVal;
_SocketAddrResponse_u AsyncRsp;

UINT8 pObjIdx = MAX_CONCURRENT_ACTIONS;


Msg.Cmd.sd = sd;
Msg.Cmd.family = (sizeof(SlSockAddrIn_t) == *addrlen) ? SL_AF_INET : SL_AF_INET6;

/* Use Obj to issue the command, if not available try later */
pObjIdx = _SlDrvWaitForPoolObj(ACCEPT_ID, sd & BSD_SOCKET_ID_MASK);

if (MAX_CONCURRENT_ACTIONS == pObjIdx)
{
return SL_POOL_IS_EMPTY;
}

OSI_RET_OK_CHECK(sl_LockObjLock(&g_pCB->ProtectionLockObj, SL_OS_WAIT_FOREVER));

g_pCB->ObjPool[pObjIdx].pRespArgs = (UINT8 *)&AsyncRsp;

OSI_RET_OK_CHECK(sl_LockObjUnlock(&g_pCB->ProtectionLockObj));
/* send the command */
VERIFY_RET_OK(_SlDrvCmdOp((_SlCmdCtrl_t *)&_SlAcceptCmdCtrl, &Msg, NULL));
VERIFY_PROTOCOL(Msg.Rsp.sd == sd);

RetVal = Msg.Rsp.statusOrLen;