flush - flush output



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.

flush returns nothing.


Please wait for this command to execute: <P>
<EXEC longcommand>
<LOOP $ret>
  $ret <BR>

This example flushes 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.

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.

fmtcp, mm, rex

Copyright © Thunderstone Software     Last updated: Oct 24 2023
Copyright © 2024 Thunderstone Software LLC. All rights reserved.