protected void page_load(object sender, eventargs e) { response.buffer = false; while (true) { response.write(delimiter + datetime.now.tostring("hh:mm:ss.fff")); response.flush(); // suspend thread 1/2 second system.threading.thread.sleep(500); } // yes know we'll never here, it's hard not include it! response.end(); }
when response.flush() executed, new webpage sent client while block run forever on server when new maeeage reaches client, there refresh new data how posible continue same place. shouldn't there new page object created?
there few problems you've described...
1) you've described mis-matching client , server code. server code there works single ajax request hangs around forever, , gets notified on client doesn't start new request. in comments, however, you've described client does start new request. 2 concepts won't work together.
2) elaborating on point 1, request never ending means browsers never see it. "typical" ajax requests won't change state until entire contents arrive, request hang forever. you'll have end request, or use xhr request changes state each chunk flushed server, viable in browsers.
3) if 1) worked, proxies, etc, kill request eventually. don't requests sitting around forever.
4) that's blocking synchronous request, which'll eat server resources crazy. won't beyond threadpool limit before fails catastrophically.
so yea, example you've given here doesn't make sense :).
Comments
Post a Comment