Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How Can a servlet automatically send a response without a request ?

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello ,
I am trying to develop a simple Net game , wherin two users can LogIn and play against each other.
I have decided to use Servlets for this project.
The probelem is :
When one user makes certain moves on his screen the same has to be reflected to the other user as well, without the other user(or client) sending a request.How do we achieve that ?
Morever should i use anything other than Servlet for this ?
Thanx in advance,
Milan
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
i think u can use "refresh" and mention the time.

prasad
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a similar problem = refresh a page without the client making the explicit request to do so.
I am now using Jason Hunter's "Java Servlet Programming" O'Reilly Publisher. In Chapter 6:Sending MultiMedia Content, he describes 2 methods: 1)[Client pull] "the client uses the Refresh header value sent by the server to determine when to perform its update". He recommends this when the updates are infrequent or occur at known time intervals. 2)[Server push] Jason recommends this approach for "limited-length animations and for real-time updates". There is some example code. There is also an example chat server in Chapter 6:Applet-Servlet Communications. These two examples show two different ways for server push.
see the following: http://www.oreilly.com/catalog/jservlet/
 
He repaced his skull with glass. So you can see his brain. Kinda like this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic