473,406 Members | 2,847 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,406 software developers and data experts.

forcing an http request to sleep/delay

Hi all,

I'm trying to use asp.net to code a chat window and I would like to make the
http request delay as long as possible till the process/thread detects a new
incoming message.

basically something like the following:

while(nonewmessages) {
nonewmessages = checkfornewmessages();
delay(100);
}

I haven't found a delay function nor does thread.sleep works.

I understand that coding a meta tag refresh rate can resolve the problem in
a "pull" like fashion but I would like to "push" the data on the fly through
displaying existing chat messages and then holding the http request
connection until next message arrives. At that point a refresh can be made
and thus saving unnecessary amounts of requests being made to the server.

Thanks for any input into this matter.

Robert Huie
Nov 18 '05 #1
1 1106
Robert Huie wrote:
I understand that coding a meta tag refresh rate can resolve the problem in
a "pull" like fashion but I would like to "push" the data on the fly through
displaying existing chat messages and then holding the http request
connection until next message arrives. At that point a refresh can be made
and thus saving unnecessary amounts of requests being made to the server.


Robert, HTTP is structured as a request/response protocol, with the
client initiating a request, and the server sending a response. The
point being, I think you're not going to be able to do what you want
without using a Java applet or something like that - an actual program
that establishes a peer-to-peer connection between the client and
server. Point being, HTTP is not designed to accomplish what you're after.

Now, there are some "workarounds" that can give the end user the
perception that the screen is only updating when needed. For example,
you could have a hidden frame that checks back periodically, and if
there are new messages, then it refreshes the main window...

Hope this helps.

--

Scott Mitchell
mi******@4guysfromrolla.com
http://www.4GuysFromRolla.com
http://www.ASPFAQs.com
http://www.ASPMessageboard.com

* When you think ASP, think 4GuysFromRolla.com!
Nov 18 '05 #2

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

Similar topics

1
by: pdectm | last post by:
I'm trying to prototype an application which runs multiple python scripts, each in its own interpreter and OS thread. I've not been able to forceable stop a script which does not respond to a...
4
by: Xaradas | last post by:
How can I suspend the execution of a script for x seconds? Does exists something like sleep(x)? Thanks. ------------------------------------ "Computer Science is no more about computers ...
7
by: John | last post by:
Thanks. I am writing a C++ code on Linux and Sun OS platform. How to make a procedure sleep or delay? Thanks again. "John Carson" <donaldquixote@datafast.net.au> wrote in message...
21
by: Alo Sarv | last post by:
Hi From what I have understood from various posts in this newsgroup, writing event loops pretty much comes down to this: while (true) { handleEvents(); sleep(1); // or _sleep() or...
2
by: Ford Prefect alias Armin | last post by:
Hello I have a Problem of understanding how IIS/ASPX Works..... Why can't to request run at the "same" time ?? I have a Simple ASPX Web Application. It has two Button.
1
by: Robert Huie | last post by:
Hi all, I'm trying to use asp.net to code a chat window and I would like to make the http request delay as long as possible till the process/thread detects a new incoming message. basically...
4
by: SheldonMopes | last post by:
Is there a way to force Access to pause execution for a specified period of time ? I would like a command button on a form to run it's code when clicked and then pause for 2 seconds before allowing...
13
by: Charles Zhang | last post by:
Sleep() function Sleep at lease 1 millisecond, there is a way to make a thread to sleep less than a millisecond? One way I know of is using performance counter which is not really sleep ( loop and...
2
by: virupax | last post by:
Which is the best one to use sleep or delay ( for a delay in the process ) .As i understand use of sleep, allows the kernel to schedule the process. And if a sleep of microseconds is used, and...
3
by: evenlater | last post by:
I have an Access application on a terminal server. Sometimes my users need to export reports to pdf, rtf or xls files and save them to their own client device hard drives. They can do that right...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.