Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

getting a client to wait in run()

 
aza chung
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I'm new at this, so please be easy on me I'm trying to get a client to wait for a server's response by using the following structure in the thread's run() (using Runnable).

But this gives me an exception after the first loop because it is continously doing the while loop and trying to read something from server. And if I use 'if' instead of 'while', it only goes through it once, and doesn't listen for anymore server messages. Is there anyone who can steer me in the right direction on this? Thanks.
 
Jose Botella
Ranch Hand
Posts: 2120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch aza.
I have written a code to show that I do not have an exception because of the fact the thread is looping forever calling readObject:

You may find interesting One way messages by Dough Lea
[ November 17, 2002: Message edited by: Jose Botella ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!