Solved

What's the behaviour of CGI?

Posted on 2000-05-05
4
185 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 10

Accepted Solution

by:
makerp earned 150 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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
This article will show, step by step, how to integrate R code into a R Sweave document
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…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

635 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