ajax - Multiple flush statements in PHP and Apache -


i' using xmlhttprequest 2 chunked response through it's onprogress event , displaying in browser. seems work fine have little confusion. consider following code:

<?php      echo "i' sending ";     ob_flush();     flush();      echo "content client.";     ob_flush();     flush(); 

this pretty standard php way of sending chunked response client. expecting output 2 different chunks, 1 containing first echo's result , other containing second's. i' getting single combined chunk of both echo statements. when put sleep(1) after first flush() seems work fine.

my question is there deliberate wait on webserver side wait other content before sending received chunk or there thread scheduling mechanism forcing network layer of apache wait it's turn.

edit

i forgot mention have disabled webserver's output buffering means if flush php sent browser.

any highly appreciated.

thanks.

see: http://www.icemelon.com/tutorials/20/output_while_script_still_running.htm

you may seeing browser output buffering here. try adding:

for($k = 0; $k < 40000; $k++)     echo ' '; 

right before flush in order fill browser's buffer , make spit out output.


Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -