NetX HTTP Client - Verify multiple files existence


I need to verify the existence of a list of files, and their size, before download them from internet.


Now I am using the "nx_http_client_get_start" but:

  • when the file DOES NOT exist the function returns "0xE2" (NX_HTTP_FAILED) and I can try with another file.
  • when the file DOES exist the function returns "0x00" (NX_SUCCESS) but following attempts to use the same function for others file always fail with "0xEA" (NX_HTTP_NOT_READY).

I think that NetX HTTP Client is waiting that I call the "nx_http_client_get_packet" to download the file, but it is not my purpose.


Is there another way or is there a correct sequence to reset the HTTP client state?


Thank you very much!


  • Hello Angler,

    Once nx_http_client_get_start returns NX_SUCCESS, GET request processing has begun. The correct way of proceeding, in case where you're not interested in fetching the actual file, is to call nx_http_client_get_packet followed by nx_packet_release in a loop, until get_packet returns NX_HTTP_GET_DONE. This will effectively download the file but discard it. Alternatively, you can also use nx_http_client_socket field inside NX_HTTP_CLIENT structure to perform nx_tcp_socket_disconnect followed by nx_tcp_client_socket_unbind. You will also need to set nx_http_client_state to NX_HTTP_CLIENT_STATE_READY so that client can be used for another request. Bear in mind that second solution is technically a hack (otherwise there would be get_stop API provided) and may not work with some servers you're connecting to (i.e. server will deny subsequent requests).


  • In reply to Renesas Karol:

    Ok, I understand.

    Thank you Karol!
  • am using nx_tcp_socket_send to send my http get request and nx_tcp_socket_receive to receie the response but i can't download the content of my file or even see it i only see the content-type and length is there an api to download the file ? thank you