• 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

java.io.EOFException between applet and servlet

 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I use the following code to pass an object from applet to servlet, then receive another object from servlet to applet. Got the
java.io.EOFException error.
It is Signals that an end of file or end of stream has been reached unexpectedly during input. What could be the reason?

datato=new dataToservlet(year,month,day,hour,minute,timelength);
datafrom=new dataFromservlet(area,channelnum);

try{
URL url=new URL(servletPath);
URLConnection conn=url.openConnection();
conn.setDoInput(true);
conn.setDoOutput(true);
conn.setUseCaches(false);
conn.setDefaultUseCaches(false);
/****send object from applet to servlet******************/
conn.setRequestProperty("Content-Type","application/octet-stream");
ObjectOutputStream toServlet=new ObjectOutputStream(conn.getOutputStream());
toServlet.writeObject(datato);
toServlet.flush();
//toServlet.close();
/****get object df from servlet*********/
ObjectInputStream fromServlet=new ObjectInputStream(conn.getInputStream());
datafrom=(dataFromservlet)fromServlet.readObject();
}catch(Exception e){appleterrormessage=e.toString();appleterror=true;}
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic