I have a simple C++ CGI Application that receives form data from client. The client is written in C# and uses WWWForm to send and receive data to the C++ CGI Application and everything seems to be working with one exception.
For example, when I send a registration form to the CGI Application, My CGI Application is able to receive the data but when I send an email to the email provided in the form, it makes the client to wait until the email is sent before it disconnects.
I want to process the data, disconnect the client then send the email because sending emails takes time and I want the server response to be fast.
How can I disconnect the client from the CGI Application? Currently right now, the only way the client disconnects is when the CGI Application closes or ends but is there a way to disconnect the client prematurelyso that it doesn't have to wait for the email to finish sending?
I did online research about this but didn't find any single solution to this.
I wrote a very simple c++ cgi using CodeBlocks and MinGW.
All it does is that it creates a detached process and returns directly. It doesn't read any request. That will be left to you.
To get data to the new process you will probably have to write what you want to send into a file and then provide the path to that file to the new process via the commandline that is passed to CreateProcess.
I tested the cgi using Xampp. Please note that you will have to look into the Task Manager in order to check the process has been started as no window will open up.