How to implement web interface for my app?

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
michalm
Earned some good credits
Earned some good credits
Posts: 122
Joined: Wed Dec 13, 2006 3:25 pm

How to implement web interface for my app?

Post by michalm » Tue Apr 17, 2007 10:11 am

Hello.

How can I implement web interface for my application? I assume, that I should create simple web server, and what next?

How can I create http server and how to implement execution web commands in my program?

Where can I get some code examples?

Jorg
Moderator
Moderator
Posts: 3971
Joined: Fri Aug 27, 2004 9:38 pm
Location: Delft, Netherlands
Contact:

Post by Jorg » Tue Apr 17, 2007 11:53 am

I see no relevance with wxWidgets in your question. I suggest googling for some examples, although creating a webserver in C++ is a hell of a job. Why not try Python or use PHP?

http://www.google.nl/search?q=creating+ ... =firefox-a

- Jorgen
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb

michalm
Earned some good credits
Earned some good credits
Posts: 122
Joined: Wed Dec 13, 2006 3:25 pm

Post by michalm » Tue Apr 17, 2007 4:40 pm

I see no relevance with wxWidgets in your question.
I have win32 application written using wxWidgets and now I want to create web interface for it. I want to remote control it using web browser. So I can't use php.

Or maybe better way is to use any simple free http server, but I have no idea how to link it together with my application?

I thought, that there are some wxWidgets classes that can make it easier.

I'm sorry if this is offtopic, but I can't find any information about this problem

upCASE
Site Admin
Site Admin
Posts: 3176
Joined: Mon Aug 30, 2004 6:55 am
Location: Germany, Cologne

Post by upCASE » Wed Apr 18, 2007 7:09 am

Hmmm...
To me this sounds a little like CGI.
OS: OpenSuSE, Ubuntu, Win XP Pro
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4

"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda

Jorg
Moderator
Moderator
Posts: 3971
Joined: Fri Aug 27, 2004 9:38 pm
Location: Delft, Netherlands
Contact:

Post by Jorg » Wed Apr 18, 2007 9:44 am

No it is not off topic, but not mentioning wxWidgets made me at least a bit suspicious that it was a regular C++ question.

Also, I would reconsider using C++. Maybe you can use a server back end from a scripting language and connect to a DLL / EXE that contains your business logic.

I am not experienced in this, but for example you can use XML to pass data around from your business logic to your webserver, and implement visualisation in there. It's much more flexible then writing a webserver by hand.

- Jorgen
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb

Sunsawe
Experienced Solver
Experienced Solver
Posts: 54
Joined: Tue Jan 30, 2007 5:04 pm

Post by Sunsawe » Wed Apr 18, 2007 9:51 am

Well...

I think this is not that difficult depending on how you can modify your application.

My guess is that you need a normal web server like Apache, no need to create on.
Then you have to make a real website with whatever language you want, it doesn't matter.

The thing is that you have to allow you application to act as a server. The website is going to be its client.
So you must make your application listen on a port.
Then your website must handle some scripts or cgi bin that can connect to the application and proceed whatever you want ( i know that in python it can be really easy...).

I have seen this case on an application where the gui was also connected that way.

On an other side, you can also get your website executing a command like:

Code: Select all

your_app -whatever -param -you_want
depending on how your application return the result (if it's supposed to...).
I have seen this case in a company having real heavy calculations to perform on huge amonts of data. The C/C++ engine was "feed" by the php website without any return to the website.

Hope that can help you.

:)

michalm
Earned some good credits
Earned some good credits
Posts: 122
Joined: Wed Dec 13, 2006 3:25 pm

Post by michalm » Wed Apr 18, 2007 8:08 pm

Thanks for your responses, now I have some ideas to consider.

Do you know any web free small http servers I can use?
I don't think that using apache is a good idea, because this is very large and complicated application and I don't need most of its functionality. All that I need is small command-line http server working without installation

[edit]
I found simple web server implementation in C++. Maybe it can be useful for someone: http://www.adp-gmbh.ch/win/misc/webserver.html

eranif
Moderator
Moderator
Posts: 607
Joined: Tue Nov 29, 2005 7:10 pm
Location: Israel

Post by eranif » Wed Apr 18, 2007 9:24 pm

upCASE wrote:Hmmm...
To me this sounds a little like CGI.
Actually this can be done using FastCGI and not CGI ..

- Use FastCGI for apache
- Make your program run as server
- when a request arrives, apache will forward it to the FastCGI module which will in turn will pass it to your application.

Use this links:

Download the apache module from here:
http://www.fastcgi.com/dist/
C++ sources to compile FastCGI sdk:
http://www.fastcgi.com/#TheDevKit

After that it should be easy

HTH,
Eran
IDE: CodeLite + wxCrafter
OS: All
https://wxcrafter.codelite.org
https://codelite.org

Post Reply