-->
Page 1 of 1

How to receive GET requests during a loop?

PostPosted: Wed Jul 29, 2015 2:51 pm
by emvee
How can I get the web server to still take GET requests when using a while loop? I am using a while true infinite loop. is there a way to restart the server? or stop it?

Im using the server.on function to call another function which contains a infinite while loop. Is there any way to still accept GET requests? Because it seems the server no longer responds to requests when using a infinite loop or during a loop. I wish i could background this loop somehow.. :?

Re: How to receive GET requests during a loop?

PostPosted: Wed Jul 29, 2015 8:45 pm
by Sprite_tm
emvee wrote:...the server.on function...

Are you sure you're using esphttpd and not some nodemcu or arduino http server?

Re: How to receive GET requests during a loop?

PostPosted: Thu Jul 30, 2015 7:40 am
by emvee
Sprite_tm wrote:
emvee wrote:...the server.on function...

Are you sure you're using esphttpd and not some nodemcu or arduino http server?


Sorry seems I posted this in the wrong section it seems.. I am using the ESP8266webserver. I will try and use esphttpd to see if it solves my issue.

Re: How to receive GET requests during a loop?

PostPosted: Thu Jul 30, 2015 11:36 pm
by Sprite_tm
It won't. Esphttpd (as are most if not all) http servers at this moment, is event-driven, meaning no infinite loops. I'd suggest re-writing whatever's in your infinite loop to an event-driven thing (maybe using timers or interrupts?). Maybe you can also get away by starting a thread using the li'l Xtensa OS functions that are there, if you can figure out how to do that safely.