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

From: jm (jmosser_at_sbcglobal.net)
Date: 04/30/04


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



Relevant Pages

  • Re: sockets, gethostname() changing
    ... I'm experimenting with a basic socket program, ... both the client and server hang and nothing happens. ... server program on my computer cannot listen on my isp's address(host, ... port = 1274 ...
    (comp.lang.python)
  • Re: Daemon perl script
    ... the server program would be described as the 'listening' ... The client is typically a program that builds ... up a connection with the deamon and quits after it's done. ... It's unlikely that the server software is authorized to kill processes ...
    (comp.lang.perl.misc)
  • Re: sockets, gethostname() changing
    ... I'm experimenting with a basic socket program, ... both the client and server hang and nothing happens. ... I discovered that the hostname of my computer automatically changes to ... server program on my computer cannot listen on my isp's address(host, ...
    (comp.lang.python)
  • sockets, gethostname() changing
    ... I'm experimenting with a basic socket program, ... both the client and server hang and nothing happens. ... server program on my computer cannot listen on my isp's address(host, ... port = 1274 ...
    (comp.lang.python)
  • Re: Work progresses on ISO COBOL definition of native support for XML
    ... client program talking to a user and a server program containing 'business ... The XML file replaces a parameter structure passed by other means, ... Three instances of the server program are launched, ...
    (comp.lang.cobol)