webcontrol of C++ app
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.
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.
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,
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.