Hi Guys,
firstly, I'm getting the EOFException while making ObjectInputStream instance and not ObjectOutputStream instance as mentioned in the subject matter !!
Following is the code through which I 'm trying to read object :
try {
URL AdminLoginServlet = new URL("http://something.com/servlet/AdminLogin");
URLConnection servletConnection = AdminLoginServlet.openConnection();
servletConnection.setUseCaches(false);
servletConnection.setDefaultUseCaches(false);
servletConnection.setDoInput(true);
ObjectInputStream inputFromServlet = new ObjectInputStream((InputStream)servletConnection.getInputStream());
String listNames = (String) inputFromServlet.readObject();
inputFromServlet.close();
} catch(Exception e)
{
System.out.println("Exception while making
servlet URL 22"+ e);
}
and following is the code through which I'm writing object :
try {
ObjectOutputStream send = new ObjectOutputStream(httpservletresponse.getOutputStream());
System.out.println("Sending user HashMap to applet...");
send.writeObject("Something");
send.flush();
System.out.println("Writing is done...");
send.close();
} catch(Exception e)
{
System.out.println("Exception here saying : "+e);
}
Writing of object is being done perfectly but while reading I'm getting the java.io.EOFException. ??? It gives me this exception even before I call readObject(), at the time when I try to create ObjectInputStream instance , why is it so ?
Can anybody let me know whats the fault ? What I have to do to read the object correctly ? Can anybody correct my code, plz...
Regards and thanx,
[This message has been edited by Sam Cala (edited June 29, 2001).]