LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 11-07-2007, 10:35 AM   #1
Furrage
LQ Newbie
 
Registered: Jul 2007
Posts: 11

Rep: Reputation: 0
How do I write a back end App for a Web Server using C++?


I am an inexperienced programmer (hobbyist) trying to write a program in C++ that a web server can interface with. The application runs continuously like a daemon or service, and the web server should act as a front end to it (i.e. I am writing a back end application for a web site). I can write the application but do not know how to add the necessary interfaces for it to talk to the web server/site. Ideally, I was targetting something that would work with the Apache http server.

Any suggestions anyone? Is there a common interface scheme that will work under Windows and LINUX for Apache?

Thanks for the help.
 
Old 11-07-2007, 11:57 AM   #2
paulsm4
Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,858
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

There are many, many, MANY alternatives (and frankly, I'm not even sure any C++ ranks particularly high among them).

In any case, as far as experimenting with a C++ back-end to a Linux/Apache GUI, this link looks interesting:

http://www.yolinux.com/TUTORIALS/Lin...ialC++CGI.html
 
Old 11-08-2007, 08:50 AM   #3
Furrage
LQ Newbie
 
Registered: Jul 2007
Posts: 11

Original Poster
Rep: Reputation: 0
I don't think CGI will work. As far as I understand CGI calls a program; which in turn runs, does some processing, and then exits. In my case the program is already running (before the request is made) and should continue running when the request is finished. I want the web request to interact with it, sending it questions and getting back responses.

I chose C++ since its what I know, and I can implement the application fairly easily in it (minus the interface for the web server, which is what I want to do now).

So what other options are there?
 
Old 11-08-2007, 10:44 AM   #4
theNbomr
Senior Member
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 4,506

Rep: Reputation: 602Reputation: 602Reputation: 602Reputation: 602Reputation: 602Reputation: 602
My analysis: the web server is a process which uses CGI to extend its capabilities by launching a child process and passing information to it, either on it's commandline (GET requests) or by piping to it's standard input (POST requests). The CGI is a process which can access whatever it needs to provide the service requested by the web server. It may do this by communicating with yet another process, such as a backend database, to use a common example. The methods used to do this are several, but in general, fall in the category of interprocess communication (IPC).
In your specific case, the C++ daemon needs to provide an IPC method which can be accessed by a CGI process. You can use one of the classic methods, such as shared memory or message queues, or you can use a socket-based approach using Unix sockets, or even Internet sockets. As I understand it, these are the most conventional methods available, and your specific requirements would dictate which is most appropriate.
--- rod.
 
Old 11-13-2007, 08:20 AM   #5
Furrage
LQ Newbie
 
Registered: Jul 2007
Posts: 11

Original Poster
Rep: Reputation: 0
Thanks theNbomr. Your post was exactly what I was looking for. Based on your suggestion I did some reading on IPCs and they have cleared up a number of misconceptions I had about sockets as well as suggest solutions that will work for me.

Thanks again.

Last edited by Furrage; 11-13-2007 at 08:22 AM.
 
  


Reply

Tags
communications, ipc, process


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
virtualizing a front end web server??? steve_f60 Linux - Software 1 10-15-2007 01:14 PM
LXer: Develop an End-to-End Ajax Web Application LXer Syndicated Linux News 0 06-16-2007 02:31 PM
Mail server set up web app? konfusionrave Linux - Newbie 1 12-28-2006 11:57 AM
help on web design and back end programming tools amolgupta Programming 7 02-21-2006 02:12 PM
installation tips for web/app server mikeh883 Fedora 3 02-05-2006 11:19 AM


All times are GMT -5. The time now is 03:19 PM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration