Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Professional
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 3rd, 2003, 11:21 AM
Registered User
 
Join Date: Jun 2003
Location: Omaha, Nebraska, USA.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Updating screen due to realtime events?

Playing around with creating a web-based MUD. The problem I'm running into is dealing with sudden events that occur in the game (Another player comes into the room, you are suddenly attacked by a monster, etc).

Due to the way HTTP is a connectionless protocol, there isn't any graceful way (that I am aware of) to update information on the browser screen once the data is 'written' to the browser. The only approach I've been able to come up with is an ugly brute force method where a small or hidden frame refreshes every second to get information from a server-based message dispatcher. This beats the hell of the web server and seems a lame way to accomplish this.

Anyone know of a better way?
Reply With Quote
  #2 (permalink)  
Old June 3rd, 2003, 01:53 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,111
Thanks: 0
Thanked 3 Times in 3 Posts
Default

This might be what you're looking for.

http://www.wsbtv.com/weather/?z=nav

Click on the 'Early Warning Doppler 2' image and you can see the countdown work.

view the source code to see the javascript.
Reply With Quote
  #3 (permalink)  
Old June 3rd, 2003, 05:35 PM
Registered User
 
Join Date: Jun 2003
Location: Omaha, Nebraska, USA.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

That example seems to rely on the method I am trying to avoid - having the page refresh itself every X seconds. It works great for a weather image that is only refreshed every 180 seconds, but I dont see anything that would support updating the info inbetween refreshes, such as a sudden tornado warning or something.

In the scenario I'm trying to code, I'd have to refresh the screen every second to check for new info, and I'm trying to avoid something that is going to thrash the server so hard. 100 users refreshing every second is going to beat the crap of of the server and drink large amounts of bandwidth with all the HTTP overhead.

Perhaps there is no other way with the HTTP protocol. I realize that what I am asking is outside the normal functionality of HTTP. I would need something more along the lines of a connection oriented protocol like Telnet, where the server can send new information any time that it needs to. With HTTP, the server has to wait around for the user to make another request before it can get any more info out to the user.

Am curious if anyone has coded around such a thing before, perhaps a javascript piece that listens to a socket on the same IP as the webserver, that could somehow change state from 0 to 1 which could then trigger the page to refresh if something important occured. Hopefully something easier than that. Maybe some interesting use of the HTTP KeepAlive functionality, but I've never seen any two-way communication over a KeepAlive connection, everything I've seen is simply to eliminate the overhead of opening a port 80 socket connection with each request. But maybe there is a way for a server to send back a "hey, look at this" type message over the KeepAlive. But nothing I know of.

Any ideas?
Reply With Quote
  #4 (permalink)  
Old June 3rd, 2003, 09:28 PM
Authorized User
 
Join Date: Jun 2003
Location: Lexington, KY, USA.
Posts: 46
Thanks: 0
Thanked 1 Time in 1 Post
Default

Sorry, I have no ideas, but I am very interested in this subject. So, I will be checking back to see if anyone has any solutions.

I have seen the hidden-iFrame approach, but it does require that the iFrame's form repost to the server at a regular interval.

-Van
Reply With Quote
  #5 (permalink)  
Old June 3rd, 2003, 09:35 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Sydney, NSW, Australia.
Posts: 215
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The best method I've come accross is to use a hidden iFrame or Frame. This refreshes regularly and uses javascript to write to the main page. The way I'd do it is to send the last refresh date with each new request, which then sends back a page that contains:
- last refesh date (for the next refresh)
- list of events that have occurred since that refresh date.

The other option is to move client side with Java, ActiveX Control or a full client side app.

regards
David Cameron
Reply With Quote
  #6 (permalink)  
Old June 4th, 2003, 04:49 AM
Authorized User
 
Join Date: Jun 2003
Location: , , .
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I agree with David, because the solution you are asking for Klom, is much the same as a chat system which also requires frequently updates.

So yes, go and see if there might be an Java applet or ActiveX component available for your needs.

Btw. coding a MUD yourself? oh that brings me memories of text based apple consoles at many educational institutions. I wonder, isn't there any of these system available for download already?
Well, just a thought. Have fun, and do let us know if you find a solution. :)


Regards
Carsten Berggreen

Monolith-Systems
Denmark
Reply With Quote
  #7 (permalink)  
Old June 5th, 2003, 10:14 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Sydney, NSW, Australia.
Posts: 111
Thanks: 0
Thanked 0 Times in 0 Posts
Default

HTTP is indeed connectionless. If you are looking for platform independance, you're going to need something like a Java Applet that can maintain a persistant connection to the server.

Cheers
Ken
Reply With Quote
  #8 (permalink)  
Old June 5th, 2003, 11:11 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Sydney, NSW, Australia.
Posts: 215
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by KenSchaefer
 HTTP is indeed connectionless. If you are looking for platform independance, you're going to need something like a Java Applet that can maintain a persistant connection to the server.
I take it the Java Applet opens a socket to the server. Don't you then also need a listening socket on the server? Is there some neat way of avoiding having to write a stack of sockets code and potentially doing a bad job of it, opening security holes?

regards
David Cameron
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Realtime Display Data on DataGridview brucelim80 .NET Framework 2.0 0 November 16th, 2007 04:54 AM
need realtime clock to chime on hour The Wizard JSP Basics 2 January 23rd, 2007 07:50 PM
realtime communication turdy VB.NET 0 February 28th, 2006 10:08 AM
Evaluating Textbox in Realtime without postback mahulda ASP.NET 1.0 and 1.1 Basics 5 March 10th, 2004 03:52 AM
Want to get my realtime clock to chime The Wizard Pro JSP 0 February 11th, 2004 08:46 PM



All times are GMT -4. The time now is 10:48 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.