Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: client/server and database with C++ |
|
Author |
|
Acropole
Joined: 26 Apr 2007 Posts: 2
|
Posted: Thu 26 Apr '07 9:43 Post subject: client/server and database with C++ |
|
|
Hi,
I'm working on a small project with C++ and apache httpd.
In this project a client send a request for a file to the server and, depending on datas from the database, the server send a file and save some statistics. It's a bit like a web browser client/server, but I don't want to use php/mysql. The system must be quick and the client is made with c++.
I'm new to client/server coding with c++ (I do it every day with php/mysql in my job), and I can't find a good tutorial about building and linking a c++ software to apache.
Should it be a dll or not ? how to connect the client with winsock ? there is so many question without answer at this time.
thanks for your help |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Thu 26 Apr '07 10:15 Post subject: |
|
|
With c++ you could run it as cgi. |
|
Back to top |
|
tdonovan Moderator
Joined: 17 Dec 2005 Posts: 611 Location: Milford, MA, USA
|
Posted: Thu 26 Apr '07 14:24 Post subject: |
|
|
If you want to link your code with Apache, an option is to write an Apache module.
This is not a trivial task - it requires a good knowledge of both Apache and of thread-safe C programming.
C++ can be used, although the Apache API uses the C calling standard.
The best reference book for writing an Apache module is "The Apache Modules Book" by Nick Kew which was published in January of this year.
It is a bit advanced to be considered a tutorial.
re: "how to connect the client with winsock?":
That probably wouldn't be necessary. An Apache module could perform the database steps and then direct Apache to send the file.
A module certainly would be quick enough, as it is a .dll which runs inside the Apache process.
re: "I'm new to client/server coding with c++":
That argues against writing your own Apache module; but maybe you want to look over the Modules book and the Apache modules docs and see if this is something you want to tackle.
-tom- |
|
Back to top |
|
Acropole
Joined: 26 Apr 2007 Posts: 2
|
Posted: Thu 26 Apr '07 19:48 Post subject: |
|
|
Thank you very much, I'll take a look to all this. |
|
Back to top |
|
|
|
|
|
|