Chat freely about anything...

User avatar
By Sifourquier
#80236 Hi i use http client from
https://github.com/espressif/esp8266-no ... _Demo/user

And try to make multiple http_request in same time

Code: Select allfor(l=0;l<3;l++)
   {
      print_debug("Value=");
      print_debug(value[l]);
      http_post(postAddress[l], value[l], "Content-Type: text/plain\r\n", httpCallback);
   }


after check the code
espconn_connect() return 0 for 3 call

connect_callback are called 3 time but sent_callback only 1 time and receive_callback also only 1 time

If i add os_printf after all espconn_sent and espconn_disconnect for help to debug the cod work fine and all callback are called that work fine.
why????

How to fix it?

if you can help me thanks you.
User avatar
By quackmore
#80253 according to what you are writing this is my guess:

espconn_send is the bootleneck
you are calling it more than one time in sequence and at each call you have to wait the previous to complete
(check the API reference)
that's why everything went fine when you added the os_printf
that was just inserting a delay before the second call, giving time to the previous espconn_send to complete

Use the sent callback to check if the previous send was completed

I raise a flag before calling espconn_send, then the sent callback will reset that flag

when I realize the espconn_send is still busy I use a pool of timers (sized according to the max "simultaneous" call you forecast) to postopone the call, that will repeat until espconn_send is found not busy

hope this will help