A beginner's question on thread
jcarlson at uci.edu
Wed Apr 7 06:54:56 CEST 2004
Timothy Wu wrote:
> I'm writing a small utility that listens for socket connections, and
> also repond to user inputs via a text menu selection.
> In order to respond to both the user and the incoming connections I
> figure I need to use thread.
> I think I would use the main thread to handle the menu and spawn a
> thread which listens on a socket.
> Now my question is, how do I terminate the server thread if user wants
> to exit the application? If the server just sit there and listen the
> thread would never terminate by itself. What kind of inter-thread
> communications are available and where would I find info/tutorial on that?
No need for threads.
If you have your server set up properly with asyncore, the below link
will give you an example using wxPython that will just work...
More information about the Python-list