Program mysteriously STOPS!

Peter Hansen peter at
Sun Jun 9 09:06:45 CEST 2002

LJD wrote:
> Hi all:
> The following code is designed (at least thats my intent) to run forever.
> The program should sit in a loop until it connects with the server.  It
> should just loop and loop and loop.
> It does, for a while, maybe five or ten minutes, but then the process just
> seems to vanish.  It's in the c1==0 loop when it quits. When I do a PS AUX,
> the process is just gone.  Obviously it quit, but more importantly WHY???,
> and what can I do so it doesn't?

You may need to investigate socket.shutdown() and socket.close() ...

Especially on Windows, you have a finite number of sockets you can have
open simultaneously.  Since socket resources are not necessarily freed by 
the underlying OS immediately upon Python releasing the reference as
it goes out of scope, you may need to be explicit.  Haven't done this 
enough under Linux to help beyond that...


More information about the Python-list mailing list