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.

CC3200: CC3200 https handshakes failure causes

Part Number: CC3200

In may application, when the HTTPS failure is due to security problem, (eg. CA file is not valid, or CA is expired), I will close the HTTPS connection and initiate a HTTP connection to cloud (The cloud support both HTTP and HTTPS). Therefore, i need to knows that the HTTPS handshake failure is due to security problem mentioned above or just due to other reasons (e.g  network jam, or server busy ). In case that the HTTPS handshake failure is not related to security problem , my application will keep retrying in HTTPS. Please tell me how to distinguish HTTPS hand shake failure causes. Is it possible to just check the return code of HTTPCli_connect(). If possible, please give me the list of return code, and tell me which return codes are security problem related.

  • Hi Lin,

    Unfortunately, by default HTTPCli_connect() returns a generic HTTP2Cli_ECONNECTFAIL no matter what the underlying socket error may be.

    What you could do is modify HTTPCli_connect() to return a more useful error code. In HTTPCli_connect(), there is a section where the return code from connect() is checked and then the HTTPCli_ECONNECTFAIL is returned if there is an error:

    ret = connect(skt, sa, slen);
        if (ret < 0) {
    #ifdef __SLP__
            if (errno(skt) == EINPROGRESS) {
                setCliState(cli, INPROGRESS_FLAG, 1);
    
                return (HTTPCli_EINPROGRESS);
            }
    #endif /* __SLP__ */
            HTTPCli_disconnect(cli);
    
            return (HTTPCli_ECONNECTFAIL);
        }

    What you could do instead, is simply return the more-useful connect() error code like so:

    ret = connect(skt, sa, slen);
        if (ret < 0) {
    #ifdef __SLP__
            if (errno(skt) == EINPROGRESS) {
                setCliState(cli, INPROGRESS_FLAG, 1);
    
                return (HTTPCli_EINPROGRESS);
            }
    #endif /* __SLP__ */
            HTTPCli_disconnect(cli);
    
            return (ret);
        }

    The list of possible errors you could get from connect() can be found in the socket.h source file located in cc3200-sdk\simplelink\include\

    Regards,

    Michael