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.

CC3100: sl_Connect failure for NON-BLOCKING TCP connection for TI’s CC31xx WiFi chip set

Part Number: CC3100

Hi,

 

We are using the TI’s CC31xx WiFi chip set.

 

Our Application uses TCP communication for which face instabilities in establishing a connection.

 

Our Application flow is :


1. socketId = sl_Socket(SL_AF_INET, SL_SOCK_STREAM, SL_IPPROTO_TCP);

2. SlSockNonblocking_t enableOption; enableOption.NonblockingEnabled = 1; sl_SetSockOpt(socketId, SOL_SOCKET, SL_SO_NONBLOCKING, &enableOption, sizeof(enableOption));

3. localAddr_ldt.sin_family = SL_AF_INET; localAddr_ldt.sin_port = serverPort; localAddr_ldt.sin_addr.s_addr = SL_INADDR_ANY; sl_Bind(socketId, (SlSockAddr_t *) &localAddr_ldt, sizeof(localAddr_ldt)) < 0);

4. serverAddr.sin_addr.s_addr = *ipAddrPtr; serverAddr.sin_family = SL_AF_INET; serverAddr.sin_port = port; ret = sl_Connect(socketId, (const SlSockAddr_t *) &serverAddr, sizeof(serverAddr));

 

Step 1 to 3 are always successful.

The instability that we see is, sl_Connect returns SL_EALREADY (-114).

Then we retry (call sl_Connect) every 100 ms again and again.

After ~ 10 sec, we receive SL_ECONNREFUSED (-111).

 

Our questions are :
1. Is the retry time of 100 ms is acceptable for sl_Connect? Or is there a recommendation for the same?
2. What are the possible causes for the SL_ECONNREFUSED? (NOTE : There is no firewall issues and such at the server end. This software does work. We only have instabilities at times.)


P.S.
We use Enterprise WPA2 network connection.

This issue is faced in few of our customer sites.

  • Hi chandrasekaran k,

    If the server is refusing the connection, you should look into why that might be happening. (Does the server have too many sockets open during peak times?) Are you able to pull server logs or sniff the disconnection?

    Best regards,
    Sarah
  • Hi Sarah,

    Thanks for your reply.

    We are trying to get the long from customer end.

    Can you let me know , my retry timing(100mS) for sl_connect() is correct or not ? suggest optimal value for retry.

    So that we can change our code to improve the system performance

    Thanks and Regards,

    Chandrasekaran

  • Hi Chandrasekaran,

    How often you check sl_Connect is only relevant to your application and what else its doing. The first time you call sl_Connect, the NWP will continue the connection process until it is successful or returns an error code to the application. If you get a return code of SL_EALREADY, you're not starting a new connection process each time.

    Best regards,
    Sarah