Rippalka
Rippalka

Reputation: 380

Web interface for a C++ program

I am developing a project for the end of my studies. This project is basically acting as a server, is cross-platform and developed in C++.

I was wondering if it was possible to make a web interface that could be used like for instance the listener design pattern to log what the program does. This would be cross platform, and is ideal since the program is supposed to run on a distant server.

My question is: is there any web technology to could let me update my web page live when the program logs something. I know this is something unusual and I'm not an expert in web technos, that's why I am asking.

Would Erlang do it ?

Thanks for your help

EDIT: To give a more concrete example, I would like to be able to follow the execution of my program live and see the logs of my program appear on the page. The idea would be to use a web page like I would use WPF on Windows or GTK on Linux for instance. Like someone said, it would be some kind on monitor for my application.

Upvotes: 4

Views: 5495

Answers (2)

Wolfgang Kuehn
Wolfgang Kuehn

Reputation: 12936

You can embed a web server such as http://code.google.com/p/mongoose and poll it using xhr or better use websockets.

Or use a monitoring solution such as Nagios (Nagios Core is free).

Upvotes: 0

Charlie Martin
Charlie Martin

Reputation: 112424

It's much easier than you might think. A web server basically gets a request as a path name, and returns a page. If you set it up correctly, it will invoke a program to create the content. This is called "CGI".

If you can do it without live updating, it's then super-easy: just refresh the page and your program can be called again.

If you want live updating, you'll need to do a little more. The easiest way is with a little lightweight javascript. The magic word here is AJAX. There are a number of tutorials on line for both of these, just google.

The main thing is to start with a very very simple example and add to it. Javascript in particular is a little peculiar; follow the tutorials, though, and you'll get it.

Upvotes: 7

Related Questions