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.

CCS/LAUNCHCC3220MODASF: keep alive Tcp socket server

Part Number: LAUNCHCC3220MODASF

Tool/software: Code Composer Studio

Hi Support,

I want ask after setting the keep-alive time-out


int TimeOut = 120;

iStatus = sl_SetSockOpt(iSockID, SL_SOL_SOCKET, SL_SO_KEEPALIVETIME,( _u8*) &TimeOut, sizeof(TimeOut));
if(iStatus < 0)
{
     UART_PRINT("[line:%d], [error:%d], [function:%s], [%s]\n\r", __LINE__, iStatus, __FUNCTION__, SL_SOCKET_ERROR);
     return(-1);
}
iNewSockID = SL_ERROR_BSD_EAGAIN;

// waiting for an incoming TCP connection
while( iNewSockID < 0 )
{
    // accepts a connection form a TCP client, if there is any
  // otherwise returns SL_EAGAIN

iNewSockID = sl_Accept(iSockID, csa, (SlSocklen_t*)&iAddrSize);
UART_PRINT("iNewSockID:%d\n\r",iNewSockID);

        if( (iNewSockID == SL_ERROR_BSD_EAGAIN) && nb == TRUE)
        {
            UART_PRINT("Sleep\n\r");
           sleep(1);
        }
       else if( iNewSockID < 0 )
       {
          // error
          UART_PRINT("[line:%d], [error:%d], [function:%s], [%s]\n\r", __LINE__, iNewSockID, __FUNCTION__, SL_SOCKET_ERROR);
         sl_Close(iNewSockID);
         sl_Close(iSockID);
         return(-1);
        }
}

So Is there a way to check when end time out keep alive then reboot or exit?

Thanks

Nguyen