[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-list
Subject:    Re: asynchronous comunication, wxPython and threads.
From:       Peter Hansen <peter () engcorp ! com>
Date:       2005-06-22 13:28:31
Message-ID: x4-dnU5iWNAt-iTfRVn-vA () powergate ! ca
[Download RAW message or body]

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 
protection).

> 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.

-Peter
-- 
http://mail.python.org/mailman/listinfo/python-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic