client socket closes, but server app doesn't see it

J

jm

Using server program with global array of sockets, each running in own thread.
When client program closes, my finalize() method closes the in/out streams
and socket (using TCP), and the server (Solaris 8 and java 1.4.2) properly
closes the socket at the TCP level (via netstat -a), but the server program
doesn't continue after the while loop to clean up. I can't figure out why the
code after the while loop doesn't run!

server program (I tried all of these) - cs is a global array of all the client
sockets and cc is the global client counter - the following is running in a
thread associated with a particular client

while(true)
{
if(cs[cc].isInputShutdown() ||
cs[cc].isOutputShutdown() ||
cs[cc].isClosed() ||
!cs[cc].isConnected())
{ break; }
}

//clean-up code runs here, but this point never reached during run-time

If I can get the clean-up code to work, I hope it will fix the larger problem
in the program, which is that threads are parenting each other - so if the
2nd client in the array drops, client 1 still works, but client 3, 4, etc.
stop working.

Thanks very much for your thoughts,
JM
 

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
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top