Hi
I do something like that on one network node (site1):
socket = new Socket(...);
oos = new ObjectOutputStream(socket.getOutputStream());
oos.writeObject(new Object());
socket.close();
On another node (lets call it site2) I frequently call
ois.readObject();
where ois is the ObjectInputStream on the same connection. I have set a
timeout for the socket at site 2. The idea is that I can do some other
work until the object actually arrived.
But unfortunately, this seems to raise problems when the socket on site
1 is closed before the object is read on site 2. In such cases, an
EOFException is thrown.
I'm not a 100% sure if this is really the reason, because it hardly
makes sense to me, because even though site1 closed the connection, the
data was sent to site2 and thus is available in the buffer...
Or does the exception arise due to another reason?
Thanks a lot! Regards,
Stefan Weber
Soren Kuula - 19 Aug 2006 01:19 GMT
> Hi
>
[quoted text clipped - 4 lines]
> oos.writeObject(new Object());
> socket.close();
Close oos instead ... that will flush thee stuff you are missing down
the Socket, before _that_ is closed (afterwards, automatically-cascaded,
as far as I remember).
Soren
vvk - 25 Aug 2006 08:29 GMT
hi,
when u close the socket, all the streams created with that socket are
closed. so when u attempt to read the streams from another node it will
araise the EOFException denotes that the socket is closed and cant
access the socket.
__Vasantha kumar
> Hi
>
[quoted text clipped - 24 lines]
>
> Stefan Weber