SYNOPSIS<flush>
DESCRIPTION
The flush
function flushes any pending (printed but not sent)
output to the server (and thus indirectly back to the web client).
Vortex buffers its output, printing a few large blocks rather than a single line at a time. This reduces the network traffic required to send the output, and can greatly increase the apparent speed of a Vortex script when viewed over a congested link.
However, in some cases this buffering can delay output, such as just
before a time-consuming command. The flush
function can be
called beforehand to force the pending output to the server (and
ultimately the user), rather than waiting for the buffer to fill.
DIAGNOSTICSflush
returns nothing.
EXAMPLEPlease wait for this command to execute: <P>
<flush>
<EXEC longcommand>
</EXEC>
<LOOP $ret>
$ret <BR>
</LOOP>
This example flush
es the output before running
longcommand
, which is some program that takes a while to run.
This helps ensure that the "Please wait" message is viewable by the
user while the command is running.
CAVEATS
The flush
function was added Mar. 19 1997.
flush
is only needed in exceptional circumstances. Calling
it repeatedly throughout a script can needlessly increase network
traffic.
It is still up to the web server to actually send Vortex's output to
the end user, and many servers buffer the output of CGI programs (like
Vortex) for the same reason Vortex does. Thus, <flush>
may not
always visibly flush the output all the way to the user on some web
servers. For greater control over CGI output, some servers can be
configured not to buffer CGI output, or operate in "no parsed
headers" (nph
) mode, which may be necessary to allow a Vortex
script more control over when its output is flushed (e.g. for
server-push documents). Consult your web server manual for details.