3 Replies Latest reply on Apr 18, 2016 7:58 AM by userc_25384

    HTTPClient TCP callbacks



      I'm writing an HTTP client application, i create my client with http_client_init() and I have an event_handler function.

      The event_handler function gets called many times, but there are more than 100 HTTP_DATA_RECEIVED events

      before a single HTTP_CONNECTED.


      I'was reading the http_client_init() code and it seems that such handler gets called from the callbacks to wiced_tcp_register_callbacks(),

      I've put a printf in such callbacks but still socket_connect_callback() gets called after some socket_receive_callback()


      Is it a known issue? I have it with both NetX and LwIP



      Matteo Croce

        • 1. Re: HTTPClient TCP callbacks

          Which version of the SDK are you using? Maybe look at the sample snip app apps/snip/httpbin_org on ThreadX/NetX_Duo for an example of how to implement the event_handler. The following screen is the results I get from running the sample app.





          • 2. Re: HTTPClient TCP callbacks

            I do observe the symptoms as matteocroce mentioned.

            I tested with WICED-3.5.2, FreeRTOS+lwIP build for snip.httpbin_org.


            If you add printf for each event case, you can see multiple

            HTTP_DATA_RECEIVED events then end with a HTTP_CONNECTED event.



                    case HTTP_CONNECTED:




                    case HTTP_DATA_RECEIVED:




            So is this HTTP_CONNECTED event a normal behaviour for a http client?

            • 3. Re: HTTPClient TCP callbacks


              I'm using SDK 3.5.2 for Linux.

              I can run the snip.httpbin_org app fine, the issue only happens on bigger files, e.g. 200 kb or more

              1 of 1 people found this helpful