client socket closes, but server app doesn't see it
From: jm (jmosser_at_sbcglobal.net)
Date: 04/30/04
- Next message: Glenn: "Re: How to display time ?"
- Previous message: Richard Riehle: "Re: Programming is not as much fun/more fun than it used to be."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 30 Apr 2004 08:16:58 -0700
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
- Next message: Glenn: "Re: How to display time ?"
- Previous message: Richard Riehle: "Re: Programming is not as much fun/more fun than it used to be."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|