Alan Kemp schrieb: > I have a problem that is half python, half design. I have a > multithreaded network server working, each client request spawns a new > thread which deals with that client for as long as it is connected > (think ftp style rather than http style connections here). Each thread > gets passed a reference to the main server to access things like the > list of connected clients, global data, etc. > ... > Can someone suggest a better (ie, valid) strategy for this?
Have a look at DBUtils (http://www.webwareforpython.org/DBUtils). Basically, there are two possibilities: Persistent connections that are bound to your server threads, or a pool of connections that are independent from the server threads. I prefer the first solution if the number of server threads stays constant. If the server regularly creates and destroys threads, I prefer spooling. DBUtils supports both. I plan to write a doco describing these ideas and the usage of DBUtils in detail. For now you need to get along with the inline docstrings. -- Christoph -- http://mail.python.org/mailman/listinfo/python-list