Go back to index | Refresh Output buffer flush

Output buffer flush

This example forces flush of output buffer repeatedly.

This technique works differently with Mongoose web server. Mongoose forces to always read 8192 characters (MG_BUF_LEN) before sending output. The solution is to output 8192 spaces before each ob_flush / flush calls. Spaces are ignored in html, so this output is not visible. It should really be 8192 characters minus characters previously outputted for it to work always correctly. In this simple examples this is not required.

Slept for 1 second
Slept for 2 seconds
Slept for 3 seconds
Done.