hi all
 
iam writing an application where i have a thread on the client end which is constantly poling the server for message objects..........
now most of the time this works fine but sometimes it gives me StreamCorruptedException...........
i have no idea how to deal with us..........so plz help me in this regard
 
here is the thread code.........
 
  public void run()
 {  
      String serviceObj = userName;
      while (true)
      {
           try
           {
                URL messageGetServletURL = new URL(EnvironmentService.urlMessageGetServlet);
                URLConnection con = messageGetServletURL.openConnection();
      
                con.setUseCaches(false);
                con.setDefaultUseCaches (false);
                con.setDoOutput(true);
                con.setDoInput(true);
                con.setRequestProperty("Content-type","application/octet-stream");
     
                ObjectOutputStream out = new ObjectOutputStream(con.getOutputStream());
                out.writeObject(serviceObj);
                out.flush();
                out.close();
    
                ObjectInputStream in = new ObjectInputStream(con.getInputStream());
                Vector userMessages = (Vector)in.readObject();
                in.close();
    
       }catch(Exception e)
           {
                e.printStackTrace();
           }
      }  
 }
   
with rgds
Rajasekhar
 
 

*********************************************************
Disclaimer

This message (including any attachments) contains
confidential information intended for a specific
individual and purpose, and is protected by law.
If you are not the intended recipient, you should
delete this message and are hereby notified that
any disclosure, copying, or distribution of this
message, or the taking of any action based on it,
is strictly prohibited.

*********************************************************
Visit us at http://www.mahindrabt.com

Reply via email to