Hi. I posted this to the C++: Microsoft forum, but haven't had a reply yet.
I want to make a cgi program that sends a file to the user. I have made this program and it works when I test it. (I have a 2Mbps connection and the web server is pretty fast.)
I got a call from the host a couple days ago that said my program was timing out. Since I have tested the code several times, I figure this is not due to a crash. I think the problem is that people on dial up who want to download something take several minutes to download the file, and as such my CGI program doesn't end for several minutes.
My question is, is there some asynchronous way to send the file to the user? The way I do it now is by a loop that keeps reading data from the file into a buffer and then writing it to stdout. (Read, write, read, write, etc.) It seems to work for me, but I think the printf statements are synchonous (i.e., they wait until the data is sent to the user before execution continues) and take too long on a dail up connection.
I want to make a cgi program that sends a file to the user. I have made this program and it works when I test it. (I have a 2Mbps connection and the web server is pretty fast.)
I got a call from the host a couple days ago that said my program was timing out. Since I have tested the code several times, I figure this is not due to a crash. I think the problem is that people on dial up who want to download something take several minutes to download the file, and as such my CGI program doesn't end for several minutes.
My question is, is there some asynchronous way to send the file to the user? The way I do it now is by a loop that keeps reading data from the file into a buffer and then writing it to stdout. (Read, write, read, write, etc.) It seems to work for me, but I think the printf statements are synchonous (i.e., they wait until the data is sent to the user before execution continues) and take too long on a dail up connection.