EOF Exception from servlet to applet.

A

Andrew Tucker

Hi guys,

Hope this isn't another dumb question, i have looked at groups.google and
have had the frustrating sitn of finding my question but no answer.

I am getting an EOF exception using ObjectInputStream form a servlet to an
applet, i can post code but thought i might see if anyone knew what to do
first.

cheers and many thanks, Andrew.
 
A

Andrew Tucker

I have been trawling for answers and found this:

--------------------------------------------------
doPost in HttpServlet says one request & one response.
The request may be as many objects as you like.
Same with the response.
You can't use the applet's output stream once you have used the
input stream. The applet doesn't complain but the servlet has
already seen EOF.
If you want to send more info then do a new post.

It is difficult to imagine an architechture in the servlet which
is anything other than a state machine.
----------------------------------------------------------------------------
How do i do a new post? I have tried dereferencing the URL and the
URLConnection and then re initialising them but
i still get the same error.

I am trying to use both input and output streams and so i think this is the
problem!!

AAAARGH!
 
S

Steve Claflin

Andrew said:
I have been trawling for answers and found this:

--------------------------------------------------
doPost in HttpServlet says one request & one response.
The request may be as many objects as you like.
Same with the response.
You can't use the applet's output stream once you have used the
input stream. The applet doesn't complain but the servlet has
already seen EOF.
If you want to send more info then do a new post.

It is difficult to imagine an architechture in the servlet which
is anything other than a state machine.
----------------------------------------------------------------------------
How do i do a new post? I have tried dereferencing the URL and the
URLConnection and then re initialising them but
i still get the same error.

I am trying to use both input and output streams and so i think this is the
problem!!

AAAARGH!

A class instantiated and running on a server doesn't have to be a
servlet. A servlet is meant to be a "one and done" type of connection,
as http generally is. If your server allows it, your servlet can
instantiate a more long-lived object which can open a server socket and
listen for the applet to connect.

Many servers won't allow server sockets, however; you would have to then
try RMI or some other approach (your servlet could maintain a session
and store the data in between calls in a database or some object whose
life is longer than one servlet call, for example).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,433
Messages
2,571,683
Members
48,796
Latest member
Greg L.

Latest Threads

Top