CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10
  1. #1
    Join Date
    Jul 2006
    Posts
    75

    Apache and program interaction

    I have Apache server installed. I'm using Flot library to plot data in the browser.
    The data is generated in other software written in C++.
    I want the JavaScript to send command (when user press button in browser or automatically every 5 min) to the program and program must respond with large data.
    How could i implement interaction between Apache server and C++ program?

    PS: I know this can be done via environmental variables (Windows) but that not good solution for me.
    Failed to Google good solution.

    Thanks

  2. #2
    Join Date
    May 2002
    Posts
    10,943

    Re: Apache and program interaction

    I'm confused! Why do you need apache web server? The flot library is a jQuery addition. You need a web server to run server-side scripting languages, not JavaScript (a client-side scripting language)
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  3. #3
    Join Date
    Jul 2006
    Posts
    75

    Re: Apache and program interaction

    Hello,

    There is a computer where C++ program runs. I want to connect to it with a browser an see the data in the browser. The data is calculated by the C++ program.
    As i understand there must be web server on computer to connect to it with a browser.
    The JavaScript is a client side language but somehow it must get data from the C++ program.
    I'm not sure how can i implement this.

  4. #4
    Join Date
    May 2002
    Posts
    10,943

    Re: Apache and program interaction

    That makes no sense whatsoever! That implementation sounds like a really horrible programming concept.

    What browser data are you attempting to get?
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  5. #5
    Join Date
    Jul 2006
    Posts
    75

    Re: Apache and program interaction

    The c++ generates array of numbers which must be plotted in the browser.
    Also there are some numbers which must be displayed in edit box.
    I want that data could be updated automatically every 5 minutes.
    Can't imagine how possible it is to implement without web server.

  6. #6
    Join Date
    May 2002
    Posts
    10,943

    Re: Apache and program interaction

    You still haven't told me why you need a web server. Notice server being the key word. If you're just opening an HTML page with some JavaScript on it, you don't need a web server.

    You really need to outline this app procedure a little more.

    • What exactly is the C++ app doing?
    • What actual data/page is opened in a web browser?
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  7. #7
    Join Date
    Jul 2006
    Posts
    75

    Re: Apache and program interaction

    Ok. I was unclear.

    There is a device running on Embedded XP. It measures some parameters of the fiber optics line. It is connected to a network.
    Operator resides far from that device and wants to watch parameters using a browser.

  8. #8
    Join Date
    May 2002
    Posts
    10,943

    Re: Apache and program interaction

    A device?...As in a peripheral? Or software?

    So basically you're trying to make the XPe machine a web server and just connect to it. In that case, why don't you just have the C++ app run as a service too. It can update a file on the local disk (same directory as the flot library HTML file). Then the HTML page which has the flot library can use AJAX to query the results.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  9. #9
    Join Date
    Jul 2006
    Posts
    75

    Re: Apache and program interaction

    >>A device?...As in a peripheral? Or software?

    It is a device which has x86 processor inside and Embedded XP.

    It is a good idea to use a file. The only problem i see is sync.
    When program is storing data to the file the AJAX must wait until file will be released.
    Is it possible to check with AJAX is file free?

  10. #10
    Join Date
    May 2002
    Posts
    10,943

    Re: Apache and program interaction

    Once again you misunderstand my question. You said...

    There is a device running on Embedded XP.
    I asked is the "device" a peripheral or software. The word "device" is too generic.

    It is a good idea to use a file. The only problem i see is sync.
    When program is storing data to the file the AJAX must wait until file will be released.
    Is it possible to check with AJAX is file free?
    There should be no file lock involved here at all. The system will write to a file which will take nano-seconds. If the server tries to read the file during that time, it will get the file's contents from before the write...not a locked file message.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

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