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.

Compiler/CC3200: To many socket SSL opened.

Part Number: CC3200


Tool/software: TI C/C++ Compiler

Hi there,

I built a test application that tries to:

  • open a ssl socket,
  • send a mqtt message,
  • close the connection.

This application runs for a long time period and the test opens and close a huge number of sockets.

After a day, I receive this error: SL_ESECT00MANYSSLOPENED.

I'm sure that each opened socket was closed. I use a printf to log each socket actions (open/close).

To be sure, if I receive this error, before retry to open the socket the system waits 100 ms.

Any suggestion about the resolution of this error?

Best Regards,

Federico

  • Hi Federico,

    API sl_Close() not close TCP connection immediately. By this API is send TCP FIN request. In case of problem in other side it take closing socket long time. It can be up to 10sec, than connection is closed properly (hard-coded timeout in NWP). Your 100ms is not enough in this case. You need wait at least 10sec when you receive this error. Alternatively you can restart NWP.

    Jan
  • Hi Jan,
    thanks for the suggestion. I try it now and I will let you know!

    Best Regards,
    Federico
  • Hi Jan,

    can I restart the only the NWP or must I restart the entire system?

    Thanks
  • Hi Federico,

    NWP reset is enough (sl_Stop(), sl_Start()). After NWP reset are not valid all sockets and open file handles.

    Jan
  • Hello Jan,

    I wrote this function to perform a NWP restart:

    uint8_t restartFailedCnt = 0;
    	int32_t opResult;
    
    	UART_PRINT( "Restarting NWP...\r\n" );
    	UART_PRINT( "\tStop NWP...\r\n" );
    	sl_Stop( 30 );
    
    	OS_sleep( 3000 );
    
    	do
    	{
    		UART_PRINT( "\tStart NWP...\r\n" );
    		opResult = InitNtwkInterface();
    		if( opResult != SUCCESS )
    		{
    			UART_PRINT( "\t### NWP restart failed... Try again\r\n" );
    			if( restartFailedCnt > NETWORK_HW_INTERFACE_MAX_NWP_RESTART_FAILED )
    			{
    				UART_PRINT( "\t### NWP restart failed... SYSTEM REBOOT\r\n" );
    				McuSoftwareReset();
    			}
                            sl_Stop( 30 );
    			restartFailedCnt++;
    			OS_sleep( 3000 );
    		}
    	}while( opResult != SUCCESS );

    Do you notice any possible problem if I try to restart the NWP several times until the connection is completed?

    Thanks for your time!

    Federico

  • Hi Federico,

    I think it should be OK. But make sure that you not change device setup inside your InitNtwkInterface() function. Often changing configuration (= write into Flash) can damage this memory.

    Jan
  • Hi Jan,

    thanks for your feedback.

    Yes I don't touch the NWP configuration. It remains the same (Station mode).

    Best Regards,
    Federico
  • Hi,

    OK, make sure that you not use API like a sl_WlanSet(), sl_DevSet(), sl_NetCfgSet(), etc.

    Jan