On Tue, Jan 27, 2009 at 12:56 AM, Tim Bowden <tim.bow...@mapforge.com.au>wrote:

> I've got a cgi script that will on occasion run for some time (exactly
> how long I'm not sure yet...) and I'd like to return a "processing
> please wait" type response to the web client if/when a certain time
> limit has passed, then have the final result sent back when the
> processing is finished.
>
> I'm a complete neophyte when it comes to cgi & http stuff else the
> answer would proly be obvious, but what's the best approach to solving
> this?
>

The typical way is to have your job run in the background and write to a
file (or some other standard place) its status or when it is completed.  A
"status" page is sent back to the browser after your job has started and
that page includes a refresh every few seconds, each time checking for the
status of your job by reading the standardized file (or checking a database,
if that is what you want to do).

That said, there are multiple ways to do this.  One important thing to
remember, though, is that the server cannot "push" information to the
browser.  The browser must "request" information.  Hence, the page refresh
is needed on an ongoing basis (or an ajax call).

Sean

Reply via email to