A beginner's question on thread
Josiah Carlson
jcarlson at uci.edu
Wed Apr 7 00:54:56 EDT 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...
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&c2coff=1&safe=off&threadm=c35daa%24ka7%241%40news.service.uci.edu&rnum=1&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DISO-8859-1%26safe%3Doff%26c2coff%3D1%26q%3Djosiah%2Bsocket%2Bwxpython%26btnG%3DSearch%26meta%3Dgroup%253Dcomp.lang.python.*
Enjoy.
- Josiah
More information about the Python-list
mailing list