TI中文支持网
TI专业的中文技术问题搜集分享网站

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

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

Viki Shi:

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

HTTPClient_sendRequest的使用请看:

HTTPClient_sendRequest()
int16_t HTTPClient_sendRequest ( HTTPClient_Handleclient,
const char *method,
const char *requestURI,
const char *body,
uint32_tbodyLen,
uint32_tflags
)
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.

赞(0)
未经允许不得转载:TI中文支持网 » CC3220SF HTTPClient库是否能够把CC3220SF采集的数据(图片或json格式文件)以json格式发送给我新建tomcat服务器?
分享到: 更多 (0)