asynchronous comunication, wxPython and threads.

Peter Hansen peter at
Wed Jun 22 15:28:31 CEST 2005

Zunbeltz Izaola wrote:
> I opened the socket once (i don't know if
> itit is important to open inside or outside the comunication thread). 

I don't believe it is important where it is opened, provided you don't 
try to do things with it from two threads at a time (without adequate 

> I didn't try it out but I
> think the problem is that i *do* comunication in both threads.

Almost certainly it is.  It would be simplest to set up a worker thread 
once, when the GUI thread begins, and simply send requests to it via a 
Queue.  It can create the socket, connect to the server, communicate, 
close it down, and go back to waiting all in one place (so to speak... 
of course this would be several methods all called from a top-level loop 
in that thread).  No chance of mis-steps.


More information about the Python-list mailing list