• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Question CGI / FastCGI and AJAX with C/C++

I need to understand the flow of AJAX in an application that is using CGI with C/C++. I can't wrap my head around what values are getting passed via CGI to the executable when AJAX is used. Once I understand this, I would like to upgrade to FastCGI as it is faster and more memory efficient. I would really appreciate if someone would volunteer to let me pick their brain. Thanks!
 
I already have connectivity via CGI using a CGI library. I suppose CGI could be made secure by using safe string handling functions/libraries? Also, I don't intend to use CGI over the internet but rather over an intranet. What I can't seem to figure out is how to successfully pass data using AJAX between the page and the C/C++ executable. Sample code showing such an interaction would be awesome. Thanks.
 
Oh. AJAX. AJAX is just JavaScript internally GETting (or POSTing to) a URL. The data returned need not look like a web page; JSON is a common format, but far from the only one. Security (of who can access that URL) can be handled by standard methods, or by you. Cookies or tokens generated after a login are common methods. Cookies are read by the HTTP_COOKIE environment variable, or, hopefully, your C/C++ CGI library. Regarding the security I mentioned earlier, if you have a C/C++ CGI library, it's probably sanitizing most of your data well enough.

You act like you want AJAX to communicate with a C/C++ executable that might already be running in the background. Is that the case? CGI starts brief, little, inherently-stateless processes. If you want to communicate with another process, you need to set up inter-process communication (IPC) yourself. A very basic method would be simple files that are watched for. What's available depends on your server's OS.
 
You act like you want AJAX to communicate with a C/C++ executable that might already be running in the background. Is that the case?
Only FastCGI can keep running in the background. That's my next step after I can do AJAX. I mainly want to do AJAX so it can update the page without refreshing the whole page. However, all around the web, I can only find mostly PHP AJAX code.
 
Note: I'm NOT a programmer. Maybe just better at searching stuff, I think.

==

Googled results:

Ajax: A New Approach to Web Applications

Ajax Frameworks


FastCGI arg list

Do you really have to use CGI/FastCGI with C?
javascript - JQuery AJAX + C CGI - Stack Overflow

Websockets

-- Full duplex messaging between web browsers and servers

==
No Ajax framework.

==

==
Asynchronous JavaScript Tutorial

==
Web programming with c++
 
Last edited:
Back
Top