I'm making a threaded chat server and I need a way to send a message to all the clients. I could use a global queue but then only one of the threads handling the clients would be able to send the message. So I was wondering if its possible to create a separate queue object within each of the client threads and append them to a list so that I would be able to send the message to each client's queue. Is this possible?
clientqueues = [] #Global list of client queues class ClientThread(threading.Thread): def __init__(self): myqueue = Queue.Queue() #Client queue clientqueues.append(myqueue) ... def MessageAllClients(message): global clientqueues for queue in clientqueues: queue.put(message) Would this work or am I going about this the wrong way?