HTTPClient TCP callbacks

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

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

0 Likes
3 Replies
JaeyoungY_71
Employee
Employee
First comment on KBA 25 solutions authored 10 solutions authored

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

pastedImage_0.png

0 Likes

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?

0 Likes
Anonymous
Not applicable

jaeyoung

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