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.

[参考译文] CC3235S:CC3235S:HttpClient_sendRequest ()将在内部重新连接。

Guru**** 2482105 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/wireless-connectivity/wi-fi-group/wifi/f/wi-fi-forum/1327587/cc3235s-cc3235s-httpclient_sendrequest-will-reconnect-internally

器件型号:CC3235S

在 HttpClient_sendRequest ()函数标题中有以下描述:

/*!
    \brief  Make an HTTP request to the HTTP server

    Sends an HTTP request-line, header fields and body to the requested URI.
    After sending the request, the request function waits for the response Status
    and Header-Fields.
    According to the response status, the request function determines whether to
    return to user or to call a redirect/callback pre-defined function.


    \param[in]  client     Instance of an HTTP client.

    \param[in]  method     HTTP method.

    \param[in]  requestURI The path on the server to open.

    \param[in]  body       The body the user wishes to send in in the request,
                           The body can be chunked or one body buffer.

    \param[in]  bodyLen    Length of the body sent in the request.

    \param[in]  flags      Special flags when the user wishes not to use the
                           default settings.
                           - #HTTPClient_CHUNK_START - First request body chunk.
                           - #HTTPClient_CHUNK_END - Last request body chunk.
                           - #HTTPClient_DROP_BODY - only keep the status code
                             and response headers, the response body will be
                             dropped.

    \note       - If user wishes to use TLS connection then before calling
                  HTTPClient_sendRequest(), HTTPClient_connect() should be
                  called.
                - If disconnection happened prior to HTTPClient_sendRequest(),
                  HTTPClient_sendRequest() will reconnect internally.
                - When sending a body in a request, the "Content-length: " and
                  "Transfer-Encoding: Chunked" headers will be added
                  automatically.

    \return     Response status code on success or error code on failure.
 */
int16_t HTTPClient_sendRequest(HTTPClient_Handle client, const char *method,const char *requestURI, const char *body, uint32_t bodyLen, uint32_t flags);

-如果断开连接发生在 HttpClient_sendRequest ()之前,
HttpClient_sendRequest()将在内部重新连接。

关于上面红色部分中的内容、
如果您  在调用 HttpClient_sendRequest ()之前关闭 Wi-Fi 热点,然后   在20秒后打开 Wi-Fi 热点, 重新连接是否会 继续?

重新连接需要多长时间?


在什么情况下,HttpClient_sendRequest()将退出执行。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    此查询已分配给我们的 软件专家。  

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好

    您是否从软件专家那里获得了最新消息

    谢谢

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    很难判断重新连接需要多长时间、因为这取决于扫描之间的间隔、但我假设应该在10至20秒内重新连接。

    下面是 HttpClient_sendRequest ()函数。

    int16_t HTTPClient_sendRequest(HTTPClient_Handle client, const char *method,const char *requestURI, const char *body, uint32_t bodyLen, uint32_t flags)
    {
        HTTPClient_CB *cli = (HTTPClient_CB *)client;
        int16_t ret;
        uint8_t retryCounter = HTTPClient_MAX_REQUEST_ATTEMPTS;
    
        do
        {
            ret = sendRequest(cli,method,requestURI,body,bodyLen,flags);
            if (((ret <= SLNETERR_BSD_SOC_ERROR) && (ret >= SLNETERR_BSD_EALREADY)) || (ret == HTTPClient_ENOCONNECTION) || (ret == SLNETERR_ESEC_CLOSED))
            {
                /* In case the connection is not persistent or sudden disconnection occured, try to reconnect */
                SlNetSock_close(cli->ssock);
                setCliState(cli,CONNECTED_STATE,false);
                retryCounter--;
            }
            else if (ret == HTTP_SC_UNAUTHORIZED)
            {
                retryCounter--;
            }
        }while((((ret <= SLNETERR_BSD_SOC_ERROR) && (ret >= SLNETERR_BSD_EALREADY)) || (ret == SLNETERR_ESEC_CLOSED) || (ret == HTTP_SC_UNAUTHORIZED) || (ret == HTTPClient_ENOCONNECTION)) && (retryCounter > 0));
    
        /* Clears the non-persistent response filter */
        clearNonPersistResponseFilter(cli);
        /* Clears the non-persistent request headers */
        clearReqHeaders(cli,false);
    
        return (ret);
    }

    此致!

    罗格利奥