objectInputStream.readObject() does not work properly after certain period of inactivity.

S

Serial # 19781010

I have a multithreaded server - one thread / client. I have a client
1 connected to thread A, and a I have client 2 connected to thread B.
After certain equal period of inactivity Client 1 sends a message to
Thread A. Thread A receives the message, and sends it back to client
1 as well as client 2. Client 1 receives the message succesfully but
then when Thread A tries to send to client 2 out of a sudden Thread B
throws "Connection Reset By Peer" where it was blocking on
..readObject(); (note that Thread B has not read anything from CLient 2
cause Client2 never wrote anything.) and then (right after that)
Thread A throws a "Broken Pipe" exception where it did .writeObject()
which is strange as Client 1 actualy receives the message succesfully
from thread A. This only happens if there is a period of inactivity
on both clients, other than that everything works fine.
 
R

Roedy Green

Thread A throws a "Broken Pipe" exception where it did .writeObject()
which is strange as Client 1 actualy receives the message succesfully
from thread A

You did not say which OS you are having this trouble on. you could
resort to heartbeat dummy messages to keep the pipe alive, or just
auto reconnect if it dies on you.
 

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,434
Messages
2,571,691
Members
48,796
Latest member
Greg L.

Latest Threads

Top