• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Random communicaton....Servlet to Applet ???

 
Kruger Brent
Greenhorn
Posts: 26
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,
Unfortunately, I am stuck with a problem of sending info to the requesting applet as and when servlet wants to. Meaning that the
applet in its run() should continuosly wait for any incoming
messages from servlet. But what happens is the run() does not
block the program flow when it reaches statement....
String info = (String) ois.readObject()... as it normally does
when the communication is based on ServerSocket and socket
objects, but here the communication is based on URL and
URLConnection objects.
I succeed in sending request from applet to servlet using URL and
URLConnection objects and also in getting response from servlet
once but, as my run() is in while loop it throws IOException on
not getting further responses.
Any idea over this?
KB
[This message has been edited by Kruger Brent (edited January 19, 2001).]
 
Roshini Sridharan
Ranch Hand
Posts: 143
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

are u creating the object outside the loop/ inside, pls clarify.
If u are creating the ObjectInputStream object inside, try putting it before the loop.
Roshini
 
Kruger Brent
Greenhorn
Posts: 26
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Roshini,
I am creating the ObjectInputStream object before the loop. And is it that for every request made by applet we have to create a new object of URL and URLConnection?
KB.
 
Roshini Sridharan
Ranch Hand
Posts: 143
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No it's not required to create new URL & URLConnection object each and every time, then it creates a problem like socket already open.
RoshiniSridharan
 
Kruger Brent
Greenhorn
Posts: 26
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well then I am unable to make request for the 2nd time using the same ObjectOutputStream object. You mean if we use the same object to make a request to servlet it would again invoke the doGet() of the servlet?
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic