Hi @Carl Lee Greetings! Welcome to Microsoft Q&A forum. Thank you for posting this question here.
I would like to make a note that the service nx_web_http_client_post_start
has been deprecated. It is highly recommended to use *nx_web_http_client_post_start_extended
as an alternative approach to achieve the same. The Post request accepts the following parameters.
UINT nx_web_http_client_post_start_extended(
NX_WEB_HTTP_CLIENT *client_ptr,
NXD_ADDRESS ip_address,
UINT server_port,
CHAR *resource,
UINT resource_length,
CHAR *host,
UINT host_length,
CHAR *username,
UINT username_length,
CHAR *password,
UINT password_length,
ULONG total_bytes,
ULONG wait_option);
Here is a description on the input parameters of the method.
- client_ptr: Pointer to HTTP Client control block.
- ip_address: IP address of the HTTP Server.
- server_port: TCP port on the remote HTTP Server.
- resource: Pointer to URL string for requested resource.
- resource_length: String length of requested resource.
- host: Null-terminated string of the server’s domain name. This string is transmitted in the HTTP Host header field. The host string cannot be NULL.
- host_length: String length of host.
- username: Pointer to optional user name for authentication.
- username_length: String length of user name for authentication.
- password: Pointer to optional password for authentication.
- password_length: String length of password for authentication.
- total_bytes: Total bytes of resource being sent. Note that the combined length of all packets sent via subsequent calls to nx_web_http_client_put_packet must equal this value.
- wait_option: Defines how long the service will wait for the HTTP Client get start request. The wait options are defined as follows:
- timeout value (0x00000001 through 0xFFFFFFFE) Selecting a numeric value (0x1-0xFFFFFFFE) specifies the maximum number of timer-ticks to stay suspended while waiting for the HTTP Server response.
- NX_WAIT_FOREVER (0xFFFFFFFF) Selecting NX_WAIT_FOREVER causes the calling thread to suspend indefinitely until the HTTP Server responds to the request.
- timeout value (0x00000001 through 0xFFFFFFFE) Selecting a numeric value (0x1-0xFFFFFFFE) specifies the maximum number of timer-ticks to stay suspended while waiting for the HTTP Server response.
Here is an example on how to use this method.
/* Connect to a remote HTTP server. */
server_ip_addr.nxd_ip_version = NX_IP_VERSION_V4;
server_ip_addr.nxd_ip_address.v4 = IP_ADDRESS(1,2,3,5);
/* Start an HTTP POST to post the 20-byte resource "/TEST.HTM" to the HTTP Server
at IP address 1.2.3.5. */
status = nx_web_http_client_post_start_extended(&my_client,
&server_ip_addr, NX_WEB_HTTPS_SERVER_PORT,
"/TEST.HTM", sizeof("/TEST.HTM") – 1,
"host.com", sizeof("host.com") – 1,
"myname", sizeof("myname") – 1,
"mypassword", sizeof("mypassword") – 1, 20,
NX_WAIT_FOREVER);
/* If status is NX_SUCCESS, the POST operation for TEST.HTM has successfully been
started. */
Please find the reference to the official documentation on nx_web_http_client_post_start_extended method for more details. Hope this helps! Please let us know if you have any additional questions on this.
If the response helped, please do click Accept Answer and Yes for the answer provided. Doing so would help other community members with similar issue identify the solution. I highly appreciate your contribution to the community.