- Category: Development
- Published: January 4, 2017
- Hits: 712
Composing yesterdays post, I was frustrated. Nothing was working and my newbie perl abilities were letting me down.
I decided to stop developing and start reading. I browsed through the developer section at forums.slimdevices.com, looking out for discussions that were relevant to my problems and might make more sense now that I'm several months into my perl career.
I few discussions rang some bells and some pointers were noted. The overriding impression I took away was that I needed to be working with the LMS, not against it. I'd been trying to shoehorn a http server running in a background process using external libraries. But what if I could leverage the LMS to manage a lot of this?
Bingo! In a couple of hours today, I got a http daemon running under the Slim::Networking::Select loop using addRead. No more background process voodoo required. It's a quick and dirty implementation right now but it behaves impeccably; no conflicts and no shutdown problems - and it works on Windows and Linux. Yay!
There's a bit more to do - I need to manage the stop and restart of the server if the user changes port or elects to switch it off, but that should be reasonably straightforward. There's also http client support inside LMS itself, maybe with HTTPS capabilities. Who knew??
I really feel that I'm making progress, which is good news!