Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jan 2005
    Chicago, IL

    webcontrol of C++ app

    Hi all,

    This may not be the perfect place to post this question but I couldn't find a better one... I would like advice on how to set up a web interface for a C++ app that monitors and controls an I/O board. Let me explain:

    A PCI I/O board is controlled by a custom-made controlIO.cpp. It runs infinitely. controlIO.cpp receives info from the board, but also accepts user input to control the output ports of the board.

    I would like to device a webpage which updates every 5 seconds or so, and which displays the current status of the IO board, but also allows a user to click on links that send commands to controlIO.cpp.

    I'm running apache on CentOS, but obviously this is irrelevant.

    My proposal:

    To create a CGI script which communicates with the controlIO.cpp via a socket. This socket would be incorporated in a non-blocking fashion as of not to disrupt the rest of activities within the controlIO.cpp.

    Every time the webpage is updated (javascript?) a request is made to the CGI script to get data from the crontrolIO.cpp. These data are then properly formated in the form of HTML by the CGI script.

    At the same time, when the user click on a link (e.g. turn_off_light), this is sent to the CGI script, which transmits the order to the controlIO.cpp via the socket.


    1) Is this a reasonable train of though? If not, please advice.
    2) Should I use two sockets: one for sending commands from the CGI script to the controlIO.cpp and another to send the status report from the controlIO.cpp to the CGI script?
    3) I was thinking PERL for the CGI script, any reasons to use a different language?
    4) Any other comments/ideas?

    Thanks a lot,


  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    You can use any suitable language as long as you get an executable that conforms to the argument types required for a CGI program. Since you need something that knows how to communicate with sockets this can be Perl, Python, C++, Java, whatever. Use what you are most comfortable with.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

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