|Pathologically Eclectic Rubbish Lister|
Re^4: Adding simple HTTP controls to existing codeby brachism (Novice)
|on Jul 05, 2021 at 16:48 UTC||Need Help??|
Sorry, for possibly being too verbose in this thread. First, thanks for replying.
I have a Perl program. The 1,300-ish line program runs on a headless box. It works great. It blissfully runs along managing a series of tasks. It also has absolutely nothing to do with the network.
I simply need that program to also listen on the network for very infrequent simple HTTP requests. Those requests, if valid, simply tweak parameters in that Perl program altering it functionality. The client, in this case is not Perl. The client is just some simple web browser passing a parameter within the URL. No parallel, one host, and one client.
The core of my program is basically an endless loop, that fires roughly every 200ms. If there is something for it to do, it does it. I just want to add into that loop, a listener for requests. If we got a request in the last 200-ish ms, process it, and continue on. If not, continue on.
The solutions I found online and tried, all so far seem to be blocking. In other words, when I check for a request, it just listens and waits forever. Some did have timeout features, but waiting and timeout out repeatedly for infrequent traffic just seems wasteful.
I just figured this would be easier. On a NodeMCU ESP8266 this is just a few lines of code.
I will investigate Corion suggestions. This is basic stuff, so I'm sure I’ll figure out something.