Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • 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
 
prasad Chandrasekaran Iyer
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
i think u can use "refresh" and mention the time.

prasad
 
Irene Fernandez
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • 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/
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic