• 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

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

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).]
 
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic