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.

CC3220SF HTTPClient库是否能够把CC3220SF采集的数据(图片或json格式文件)以json格式发送给我新建tomcat服务器?



1.HTTPClient_sendRequest该API是否能完成文件,图片上传给HTTP服务器?

  • 不行,文件是通过file system传输的。

    HTTPClient_sendRequest的使用请看:

    HTTPClient_sendRequest()
    int16_t HTTPClient_sendRequest ( HTTPClient_Handle client,
    const char * method,
    const char * requestURI,
    const char * body,
    uint32_t bodyLen,
    uint32_t flags
    )
    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.

    Parameters
    [in] client Instance of an HTTP client.
    [in] method HTTP method.
    [in] requestURI The path on the server to open.
    [in] body The body the user wishes to send in in the request, The body can be chunked or one body buffer.
    [in] bodyLen Length of the body sent in the request.
    [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.
    Returns
    Response status code on success or error code on failure.