CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2009
    Location
    oklahoma
    Posts
    199

    Communicate with daemon.

    I plan on developing on a Single Board Computer that runs linux.
    This board will run a daemon I create that does some controlling of the ADC functions on board and such.

    This board will also host a web server for all the interfacing.
    What do I need to do to make a PHP/CGI/etc... script be able to "talk" to this daemon? I also need for it to return data as well.

    Sorry its so broad, but I just need a few pointers to get started.

  2. #2
    Join Date
    Jun 2009
    Location
    oklahoma
    Posts
    199

    Re: Communicate with daemon.

    I'll answer my own question.

    On my linux application, I can use the mkfifo() command that will create a pipe.
    PHP can read/write to this pipe just as if it was a file.

    My linux application creates a new thread that has a while(true) block that runs a blocking function to read the pipe.

    So... the 'infinite' loop thread will just sit there until data is written to that pipe, and then it can respond back.

    Looking down the road a bit...
    I will eventually create a website that will use AJAX methods to continuously poll for data from my daemon using the same php/pipe method.
    Last edited by jnmacd; September 3rd, 2010 at 03:42 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured