socket server interrupt?

Cliff Wells logiplexsoftware at earthlink.net
Thu Feb 14 12:46:18 EST 2002


In article <mailman.1013690723.25180.python-list at python.org>,
"maximilianscherr" <MaximilianScherr at t-online.de> wrote:
> how can i make my socket server interrupt on ctr-c(i know with the
> keyboardinterrupt exception, but how?)?

The problem you will have with this approach is that your server is
multi-threaded; you won't know which thread will receive the interrupt.
A better alternative is to start yet another thread that accepts console
input and can shut the server down using a command, say 'q' or 'x'.

- Cliff



More information about the Python-list mailing list