in reply to Preventing Browser Timeout

Any idea how this can be done? I imagine that I'd need to fork the processing off as one process and somehow keep tabs on it's progress or something.

merlyn has an article describing how to do the fork/keep-track-of trick.

An alternative is to periodically send a "heart-beat" to the browser, to let it know that the CGI is still alive. A periodic

print "<!-- working -->\n";
is sufficient, provided you've disabled buffering. If you're processing multipe files, try doing this once per file.

N.B., merlyn and I are pointing to different articles. Read both.

Replies are listed 'Best First'.
Re: Re: Preventing Browser Timeout
by shotgunefx (Parson) on Apr 23, 2003 at 23:42 UTC
    Just to add to that, you can also just print " "; .

    -Lee

    "To be civilized is to deny one's nature."
      Just to add to that, you can also just print " "; .

      Sure, you can do that. The benefit of HTML comments as heartbeats is that they can also serve as diagnostic information. E.g., you can print timestamps in them, so get some feel for where your long-running program is spending time, and whether the heartbeats are too far apart (which risks a browser timeout).

        True, I mentioned the alternative mainly so the poster would realize that it didn't have to be a comment.

        -Lee

        "To be civilized is to deny one's nature."