469,352 Members | 1,794 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,352 developers. It's quick & easy.

Response.flush()

Experimenting with response.flush() but can't seem to get it to work. This
code
<%
response.write "<p>started</p>"
response.flush()
for i = 1 to 10000000
i = i +1
next
response.write "<p>ended</p>"
%>
Should it not write started to the screen straight away and then a couple of
seconds later, when the loops finished, write ended? When I test on XP Pro
and Windows Server 2003 the flush doesnt happen - the page takes a couple of
seconds to load up and then writes started ended at the same time.

Also found this article on aspfaq
http://www.aspfaq.com/show.asp?id=2498
but the response.flush() doesn't happen with that sample code either

Any ideas?

Jon
Jul 19 '05 #1
7 6566
I believe there's a thing about certain browsers, i.e. IE, where they won't
display anything until the response they've received is of a minumum number
of bytes. I don't know what the minimum is, though. You could try adding a
line like so above the <p>started</p> line:

response.write "<!-- " & String(200, "x") & " -->"

BTW, do you know that your for-loop is essentially doing a Step 2? You
don't have to increment the looping variable.

Ray at work

"Jon Spivey" <jo*******@NOCRAPTHANKStiscali.co.uk> wrote in message
news:ua**************@tk2msftngp13.phx.gbl...
Experimenting with response.flush() but can't seem to get it to work. This
code
<%
response.write "<p>started</p>"
response.flush()
for i = 1 to 10000000
i = i +1
next
response.write "<p>ended</p>"
%>
Should it not write started to the screen straight away and then a couple of seconds later, when the loops finished, write ended? When I test on XP Pro
and Windows Server 2003 the flush doesnt happen - the page takes a couple of seconds to load up and then writes started ended at the same time.

Also found this article on aspfaq
http://www.aspfaq.com/show.asp?id=2498
but the response.flush() doesn't happen with that sample code either

Any ideas?

Jon

Jul 19 '05 #2
Hi,
thanks for the reply I tried adding some more text to my little sample and
guess what - the flush happened on my dev machine XP Pro/IIS5.1 but not my
web server IIS6/Windows Server 2003. My problem is I'm working on this site
www.bookhead.co.uk if you click any of the book links the next page pulls
the book details from sql server 2000 then uses xmlhttp to get prices for
the book from 11 retailers. The db lookup is quick, the xmlhttp part can
take about 10 seconds - so I put response.flush() after the db lookup, the
flush isn't happening with the result that the page takes about 10 seconds
to display - obviously unacceptable so I need to fix this

I can't post up the code for the page I'm working on its ~150 lines is there
something you can think of that would stop response.flush() from happening?
I've also written my host to see if they have any ideas

Jon

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:Ox**************@TK2MSFTNGP10.phx.gbl...
I believe there's a thing about certain browsers, i.e. IE, where they won't display anything until the response they've received is of a minumum number of bytes. I don't know what the minimum is, though. You could try adding a line like so above the <p>started</p> line:

response.write "<!-- " & String(200, "x") & " -->"

BTW, do you know that your for-loop is essentially doing a Step 2? You
don't have to increment the looping variable.

Ray at work

"Jon Spivey" <jo*******@NOCRAPTHANKStiscali.co.uk> wrote in message
news:ua**************@tk2msftngp13.phx.gbl...
Experimenting with response.flush() but can't seem to get it to work. This code
<%
response.write "<p>started</p>"
response.flush()
for i = 1 to 10000000
i = i +1
next
response.write "<p>ended</p>"
%>
Should it not write started to the screen straight away and then a couple
of
seconds later, when the loops finished, write ended? When I test on XP
Pro and Windows Server 2003 the flush doesnt happen - the page takes a

couple of
seconds to load up and then writes started ended at the same time.

Also found this article on aspfaq
http://www.aspfaq.com/show.asp?id=2498
but the response.flush() doesn't happen with that sample code either

Any ideas?

Jon


Jul 19 '05 #3
Your code work perfectly well on my XP Pro workstation, with the web server
being on the same machine.

Maybe you are separated from you Windows Server with a firewall or a proxy
who is buffering the whole thing. Your LAN may also be involved.

I suggest that you install the web server directly on you station and then
making somes tests with that configuration.

S. L.
"Jon Spivey" <jo*******@NOCRAPTHANKStiscali.co.uk> wrote in message
news:ua**************@tk2msftngp13.phx.gbl...
Experimenting with response.flush() but can't seem to get it to work. This
code
<%
response.write "<p>started</p>"
response.flush()
for i = 1 to 10000000
i = i +1
next
response.write "<p>ended</p>"
%>
Should it not write started to the screen straight away and then a couple of seconds later, when the loops finished, write ended? When I test on XP Pro
and Windows Server 2003 the flush doesnt happen - the page takes a couple of seconds to load up and then writes started ended at the same time.

Also found this article on aspfaq
http://www.aspfaq.com/show.asp?id=2498
but the response.flush() doesn't happen with that sample code either

Any ideas?

Jon

Jul 19 '05 #4
I've run into this problem before and I've yet to find a definitive answer.
I believe that it's a browser issue, actually. When I loaded your code on
my W2K server, it did not [seem to] flush just as you described. Then I
added the long comment and it worked. Then I restored the code back to
exactly what you posted and it flushed that time. Inconsistencies do not
make sense. I believe that if you quickly do a view-source while you're
waiting for your flush, you may actually see the <p>started</p> in there.

Ray at work

"Jon Spivey" <jo*******@NOCRAPTHANKStiscali.co.uk> wrote in message
news:%2******************@TK2MSFTNGP12.phx.gbl...
Hi,
thanks for the reply I tried adding some more text to my little sample and
guess what - the flush happened on my dev machine XP Pro/IIS5.1 but not my
web server IIS6/Windows Server 2003. My problem is I'm working on this site www.bookhead.co.uk if you click any of the book links the next page pulls
the book details from sql server 2000 then uses xmlhttp to get prices for
the book from 11 retailers. The db lookup is quick, the xmlhttp part can
take about 10 seconds - so I put response.flush() after the db lookup, the flush isn't happening with the result that the page takes about 10 seconds
to display - obviously unacceptable so I need to fix this

I can't post up the code for the page I'm working on its ~150 lines is there something you can think of that would stop response.flush() from happening? I've also written my host to see if they have any ideas

Jon

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:Ox**************@TK2MSFTNGP10.phx.gbl...
I believe there's a thing about certain browsers, i.e. IE, where they won't
display anything until the response they've received is of a minumum

number
of bytes. I don't know what the minimum is, though. You could try adding a
line like so above the <p>started</p> line:

response.write "<!-- " & String(200, "x") & " -->"

BTW, do you know that your for-loop is essentially doing a Step 2? You
don't have to increment the looping variable.

Ray at work

"Jon Spivey" <jo*******@NOCRAPTHANKStiscali.co.uk> wrote in message
news:ua**************@tk2msftngp13.phx.gbl...
Experimenting with response.flush() but can't seem to get it to work.

This code
<%
response.write "<p>started</p>"
response.flush()
for i = 1 to 10000000
i = i +1
next
response.write "<p>ended</p>"
%>
Should it not write started to the screen straight away and then a couple
of
seconds later, when the loops finished, write ended? When I test on XP

Pro and Windows Server 2003 the flush doesnt happen - the page takes a

couple
of
seconds to load up and then writes started ended at the same time.

Also found this article on aspfaq
http://www.aspfaq.com/show.asp?id=2498
but the response.flush() doesn't happen with that sample code either

Any ideas?

Jon



Jul 19 '05 #5
I'm working on my laptop at the moment IIS on the same machine - no lan
firewall proxy etc. The real issue here is the site I'm working on that I
posted up earlier - not being able to get response.flush working is ruining
the site.

Just for the heck of it I uploaded Ray's code with the long string here
http://www.roksteady.net/flushed.asp

The flush works on my dev machine but is not happening on the web server -
running IIS6 Windows Server 2003. Also tested in Netscape 7 and firebird
just to be sure it isn't an IE thing. I wonder if response.flush() is
somewhat flakey or there is something I'm missing here. Either way I need to
get to the bottom of this

Jon

"Sylvain Lafontaine" <sylvain aei ca (fill the blanks, no spam please)>
wrote in message news:Op**************@tk2msftngp13.phx.gbl...
Your code work perfectly well on my XP Pro workstation, with the web server being on the same machine.

Maybe you are separated from you Windows Server with a firewall or a proxy who is buffering the whole thing. Your LAN may also be involved.

I suggest that you install the web server directly on you station and then
making somes tests with that configuration.

S. L.
"Jon Spivey" <jo*******@NOCRAPTHANKStiscali.co.uk> wrote in message
news:ua**************@tk2msftngp13.phx.gbl...
Experimenting with response.flush() but can't seem to get it to work. This code
<%
response.write "<p>started</p>"
response.flush()
for i = 1 to 10000000
i = i +1
next
response.write "<p>ended</p>"
%>
Should it not write started to the screen straight away and then a couple
of
seconds later, when the loops finished, write ended? When I test on XP
Pro and Windows Server 2003 the flush doesnt happen - the page takes a

couple of
seconds to load up and then writes started ended at the same time.

Also found this article on aspfaq
http://www.aspfaq.com/show.asp?id=2498
but the response.flush() doesn't happen with that sample code either

Any ideas?

Jon


Jul 19 '05 #6
As far as I can see this must be a server issue - from my testing the exact
same pages that refuse to flush on my IIS6 web server flush perfectly on 2
IIS5.1 computers here. Still trying to get to the bottom of this but running
out of ideas.....

Jon

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:uj**************@tk2msftngp13.phx.gbl...
I've run into this problem before and I've yet to find a definitive answer. I believe that it's a browser issue, actually. When I loaded your code on
my W2K server, it did not [seem to] flush just as you described. Then I
added the long comment and it worked. Then I restored the code back to
exactly what you posted and it flushed that time. Inconsistencies do not
make sense. I believe that if you quickly do a view-source while you're
waiting for your flush, you may actually see the <p>started</p> in there.

Ray at work

"Jon Spivey" <jo*******@NOCRAPTHANKStiscali.co.uk> wrote in message
news:%2******************@TK2MSFTNGP12.phx.gbl...
Hi,
thanks for the reply I tried adding some more text to my little sample and guess what - the flush happened on my dev machine XP Pro/IIS5.1 but not my web server IIS6/Windows Server 2003. My problem is I'm working on this

site
www.bookhead.co.uk if you click any of the book links the next page pulls the book details from sql server 2000 then uses xmlhttp to get prices for the book from 11 retailers. The db lookup is quick, the xmlhttp part can
take about 10 seconds - so I put response.flush() after the db lookup,

the
flush isn't happening with the result that the page takes about 10 seconds to display - obviously unacceptable so I need to fix this

I can't post up the code for the page I'm working on its ~150 lines is

there
something you can think of that would stop response.flush() from

happening?
I've also written my host to see if they have any ideas

Jon

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:Ox**************@TK2MSFTNGP10.phx.gbl...
I believe there's a thing about certain browsers, i.e. IE, where they

won't
display anything until the response they've received is of a minumum

number
of bytes. I don't know what the minimum is, though. You could try adding
a
line like so above the <p>started</p> line:

response.write "<!-- " & String(200, "x") & " -->"

BTW, do you know that your for-loop is essentially doing a Step 2? You don't have to increment the looping variable.

Ray at work

"Jon Spivey" <jo*******@NOCRAPTHANKStiscali.co.uk> wrote in message
news:ua**************@tk2msftngp13.phx.gbl...
> Experimenting with response.flush() but can't seem to get it to

work. This
> code
> <%
> response.write "<p>started</p>"
> response.flush()
> for i = 1 to 10000000
> i = i +1
> next
> response.write "<p>ended</p>"
> %>
> Should it not write started to the screen straight away and then a

couple
of
> seconds later, when the loops finished, write ended? When I test on
XP Pro
> and Windows Server 2003 the flush doesnt happen - the page takes a

couple
of
> seconds to load up and then writes started ended at the same time.
>
> Also found this article on aspfaq
> http://www.aspfaq.com/show.asp?id=2498
> but the response.flush() doesn't happen with that sample code either
>
> Any ideas?
>
> Jon
>
>



Jul 19 '05 #7
Did some more searching and found the answer - it seems IIS6 has some
performance issues with response.flush with a fix due in the first SP
http://groups.google.com/groups?hl=e...TF-8%26hl%3Den

Solved my own issue with a very nasty hack
do db lookup then stop
javascript to redirect to the same page
finish processing page
This accomplishes almost the same thing as response.flush() but we shouldn't
have to do things like this on supposedly "better" products

Jon

"Jon Spivey" <jo*******@NOCRAPTHANKStiscali.co.uk> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
As far as I can see this must be a server issue - from my testing the exact same pages that refuse to flush on my IIS6 web server flush perfectly on 2
IIS5.1 computers here. Still trying to get to the bottom of this but running out of ideas.....

Jon

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:uj**************@tk2msftngp13.phx.gbl...
I've run into this problem before and I've yet to find a definitive answer.
I believe that it's a browser issue, actually. When I loaded your code on
my W2K server, it did not [seem to] flush just as you described. Then I
added the long comment and it worked. Then I restored the code back to
exactly what you posted and it flushed that time. Inconsistencies do not make sense. I believe that if you quickly do a view-source while you're
waiting for your flush, you may actually see the <p>started</p> in there.
Ray at work

"Jon Spivey" <jo*******@NOCRAPTHANKStiscali.co.uk> wrote in message
news:%2******************@TK2MSFTNGP12.phx.gbl...
Hi,
thanks for the reply I tried adding some more text to my little sample and guess what - the flush happened on my dev machine XP Pro/IIS5.1 but not my
web server IIS6/Windows Server 2003. My problem is I'm working on this site
www.bookhead.co.uk if you click any of the book links the next page pulls the book details from sql server 2000 then uses xmlhttp to get prices for the book from 11 retailers. The db lookup is quick, the xmlhttp part
can take about 10 seconds - so I put response.flush() after the db lookup, the
flush isn't happening with the result that the page takes about 10

seconds to display - obviously unacceptable so I need to fix this

I can't post up the code for the page I'm working on its ~150 lines is

there
something you can think of that would stop response.flush() from

happening?
I've also written my host to see if they have any ideas

Jon

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in
message news:Ox**************@TK2MSFTNGP10.phx.gbl...
> I believe there's a thing about certain browsers, i.e. IE, where they won't
> display anything until the response they've received is of a minumum
number
> of bytes. I don't know what the minimum is, though. You could try

adding
a
> line like so above the <p>started</p> line:
>
> response.write "<!-- " & String(200, "x") & " -->"
>
> BTW, do you know that your for-loop is essentially doing a Step 2?

You > don't have to increment the looping variable.
>
> Ray at work
>
> "Jon Spivey" <jo*******@NOCRAPTHANKStiscali.co.uk> wrote in message
> news:ua**************@tk2msftngp13.phx.gbl...
> > Experimenting with response.flush() but can't seem to get it to work. This
> > code
> > <%
> > response.write "<p>started</p>"
> > response.flush()
> > for i = 1 to 10000000
> > i = i +1
> > next
> > response.write "<p>ended</p>"
> > %>
> > Should it not write started to the screen straight away and then a
couple
> of
> > seconds later, when the loops finished, write ended? When I test on XP
Pro
> > and Windows Server 2003 the flush doesnt happen - the page takes a
couple
> of
> > seconds to load up and then writes started ended at the same time.
> >
> > Also found this article on aspfaq
> > http://www.aspfaq.com/show.asp?id=2498
> > but the response.flush() doesn't happen with that sample code

either > >
> > Any ideas?
> >
> > Jon
> >
> >
>
>



Jul 19 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Dominic Godin | last post: by
5 posts views Thread by Luiz Vianna | last post: by
1 post views Thread by Dan | last post: by
2 posts views Thread by David Union | last post: by
4 posts views Thread by Mantas Miliukas | last post: by
3 posts views Thread by Lars Netzel | last post: by
reply views Thread by jose.mendez22 | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.