Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

What's the behaviour of CGI?

Posted on 2000-05-05
4
Medium Priority
?
187 Views
Last Modified: 2013-12-25
I would like to write a CGI program in C that response to the request immediately and then continue to do another job in the same CGI. However, the browser receive the response only after all the jobs have been done in the CGI.

How can I get the response immediately and the CGI keeps running on other tasks?

Many thanks!
0
Comment
Question by:andersy
  • 2
  • 2
4 Comments
 
LVL 10

Accepted Solution

by:
makerp earned 300 total points
ID: 2780204
basically this was covered by the question below.

http://www.experts-exchange.com/jsp/qShow.jsp?ta=cgi&qid=10324508 

what you need to do is create a new process by doing a fork or new thread in win32 and then close the stdout. the response will then be ended and the other process(es) will continue to run.
0
 

Author Comment

by:andersy
ID: 2783240
You mean to use
  fclose(stdout)

But How can I print to stdout if I want to print other info to the page after the process is done in the other thread?

Can I reopen the stdout and how?

many thanks.
0
 
LVL 10

Expert Comment

by:makerp
ID: 2787632
by the sound of it then you dont want to close the stdout but just flush it. so

do some proccessing

flush stdout

do your extra bit

flush and close stdout

now what should happern is the page should load at the user end but the page should have that little status bit at the bottom doing something while it waits for the rest of the page.

you might have to close the stdout and then re-open it if your cannt flush it. i know you can flush streams in C but im not sure about perl
0
 

Author Comment

by:andersy
ID: 2791635
I've tried to flush the stdout, but it won't work. It works only if I close the stdout.

Thanks anyway!
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial will discuss the log-in process using WhizBase. In this article I assume you already know HTML. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you might look at some of my other articles abo…
It is becoming increasingly popular to have a front-page slider on a web site. Nearly every TV website,  magazine or online news has one on their site, and even some e-commerce sites have one. Today you can use sliders with Joomla, WordPress or …
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

782 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question