473,320 Members | 1,939 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Thread.sleep dose not work from the first time????

al
Greetings,

I have a simple page with this code in Page_Load event(vb.net):
Response.Buffer=True

Response.write("begin test")

Response.Flush()

system.threading.thread.sleep(5000)

Respoonse.write("end test")

The browser just shows BOTH messages in the first time the page runes,
NO 5 seconds wait. However,when I refresh the page, the code runs
fine, first message for 5 seconds then the second.

MHIA,
Grawsha
Nov 18 '05 #1
3 1484
as you turned buffering on, nothing is sent to the browser until all page
processing is done. the sleep just makes the request take longer.

-- bruce (sqlwork.com)
"al" <gr*********@yahoo.com> wrote in message
news:66**************************@posting.google.c om...
Greetings,

I have a simple page with this code in Page_Load event(vb.net):
Response.Buffer=True

Response.write("begin test")

Response.Flush()

system.threading.thread.sleep(5000)

Respoonse.write("end test")

The browser just shows BOTH messages in the first time the page runes,
NO 5 seconds wait. However,when I refresh the page, the code runs
fine, first message for 5 seconds then the second.

MHIA,
Grawsha

Nov 18 '05 #2
al
"bruce barker" <no***********@safeco.com> wrote in message news:<eA**************@tk2msftngp13.phx.gbl>...
as you turned buffering on, nothing is sent to the browser until all page
processing is done. the sleep just makes the request take longer.

-- bruce (sqlwork.com)
"al" <gr*********@yahoo.com> wrote in message
news:66**************************@posting.google.c om...
Greetings,

I have a simple page with this code in Page_Load event(vb.net):
Response.Buffer=True

Response.write("begin test")

Response.Flush()

system.threading.thread.sleep(5000)

Respoonse.write("end test")

The browser just shows BOTH messages in the first time the page runes,
NO 5 seconds wait. However,when I refresh the page, the code runs
fine, first message for 5 seconds then the second.

MHIA,
Grawsha


Bruce,

I did turn the buffer off but with no change. Brower still does not wait
for 5 seconds in the first time it loads the page. it does so when I refresh.

Grawsha
Nov 18 '05 #3
al
gr*********@yahoo.com (al) wrote in message news:<66*************************@posting.google.c om>...
"bruce barker" <no***********@safeco.com> wrote in message news:<eA**************@tk2msftngp13.phx.gbl>...
as you turned buffering on, nothing is sent to the browser until all page
processing is done. the sleep just makes the request take longer.

-- bruce (sqlwork.com)
"al" <gr*********@yahoo.com> wrote in message
news:66**************************@posting.google.c om...
Greetings,

I have a simple page with this code in Page_Load event(vb.net):
Response.Buffer=True

Response.write("begin test")

Response.Flush()

system.threading.thread.sleep(5000)

Respoonse.write("end test")

The browser just shows BOTH messages in the first time the page runes,
NO 5 seconds wait. However,when I refresh the page, the code runs
fine, first message for 5 seconds then the second.

MHIA,
Grawsha


Bruce,

I did turn the buffer off but with no change. Brower still does not wait
for 5 seconds in the first time it loads the page. it does so when I refresh.

Grawsha


Solved!

All what i had to do is add longer string (>200 char)to enable buffer
to send its cont. to browser.
Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Eric Marvets | last post by:
I want to make the main thread in my app sleep while I have a worker do some arbitrary task. The problem is waking the main thread back up. Can anyone make this code sample work? private void...
26
by: news.microsoft.com | last post by:
Hi, Currently I have a thread thats spinning and doing a Thread.Sleep(someTime). I was thinking of changing this to Thread.Sleep(Timeout.Infinite); then when I have actual data in a...
8
by: Cider123 | last post by:
I ran into a situation where my Window Service had to process 100,000+ files, when I first noticed I needed to tweak various routines. Everything runs fine, but here's what I ran into: In the...
9
by: Chris Dunaway | last post by:
According to the docs, calling Thread.Sleep(0) causes the thread to be "suspended to allow other waiting threads to execute." What happens if I call Thread.Sleep(500)? Do other threads not get a...
14
by: Joe | last post by:
Does anyone know the difference, in practical terms, between Thread.Sleep (10000) and Thread.CurrentThread.Join (10000)?? The MSDN says that with Join, standard COM and SendMessage pumping...
0
by: Damien | last post by:
Hi, I have a added an edit button to my gridview and when i click it once the page refreshes but i have to click it again for the textbox to appear, this same problem as exists for the update. ...
9
by: Andy | last post by:
Hi, I have some things that act in a typical producer consumer fashion. When they have work to do, I want them doing that, but if there's no work, I'm currently using Thread.Sleep to cause...
4
by: Frankie | last post by:
This is from MSDN online (http://msdn2.microsoft.com/en-us/library/d00bd51t.aspx): "Specify zero (0) to indicate that this thread should be suspended to allow other waiting threads to execute." ...
2
by: =?Utf-8?B?UmF5IE1pdGNoZWxs?= | last post by:
Hello, I have a thread ABC that starts another thread XYX. Thread XYZ monitors various things and if there is no work to do it calls Thread.Sleep to sleep for a minute or so. Occasionally...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.