hi,
i'm using the following code open a connection to my
servlet from my
applet so i can retrieve some database info. I works fine at first but sometimes i get this error:
"java.io.StreamCorruptedException: invalid stream header"
please help.. i do not know why its so tempremental and i'm not well versed in stream headers.. how can i set the stream header to accept text from servlet. Thats all i'm transmitting, text.
Examples of what i'm getting from my servlet are:
value1|value2|value3| => works fine
key1=value1|key2=value2|key3=value3| => error occurs
=====
try{
URL servletURL = new URL(servletLocation);
URLConnection servletConnection = servletURL.openConnection();
servletConnection.setDoInput(true);
servletConnection.setDoOutput(true);
servletConnection.setUseCaches(false);
servletConnection.setDefaultUseCaches(false);
servletConnection.setRequestProperty("Content-Type","application/octet-stream");
inputFromServlet = new ObjectInputStream(servletConnection.getInputStream());
resultdata = (
String)inputFromServlet.readObject();
inputFromServlet.close();
}