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

    HTTPClient TCP callbacks

    matteocroce

      Hi,

       

      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

       

      Regards,

      Matteo Croce

        • 1. Re: HTTPClient TCP callbacks
          jayi

          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.

           

          Thanks,

          Jaeyoung

           

          • 2. Re: HTTPClient TCP callbacks
            axel.lin_1746341

            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.

             

            e.g.

                    case HTTP_CONNECTED:

                            printf("#CONN\n");

                            ...

             

                    case HTTP_DATA_RECEIVED:

                            printf("#REC\n");

                            ...

             

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

            • 3. Re: HTTPClient TCP callbacks
              matteocroce

              jayi

              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