[Twisted-Python] StdIO forwarding server

Tomas Neme lacrymology at gmail.com
Thu May 10 07:03:38 MDT 2007


I need to write a server that receives a command through stdIO and
forwards it to all of its clients. So far I've been able to create and
mantain a list of clients, but I can't send the message to all of
them.

This might be confusing, I think I have a completely wrong approach. I
used the echoclient.py example from O'Reilly's Network Programming
Essentials, and simply changed the ClientFactory to a ServerFactory,
added a clients list and changed

def dataReceived(self,data):
    self.output.write(data)

to

def dataReceived(self,data):
    for c in self.factory.clients:
        c.output.write(data)

but for some reason this comes out to the server's StdIO instead of the client's

can anyone give me some tip?

-- 
|_|0|_|
|_|_|0|
|0|0|0|




More information about the Twisted-Python mailing list