[Twisted-Python] How to get the real ClientFactory or ServerFactory object?

李祥曦 lxx1234 at gmail.com
Sun Jan 27 08:55:22 MST 2008


Hi all:
     I am new to twisted,i want to write a program like a proxy,which
get data from simplely listen to local client,transport it request to
real server,and the reply to the client.My plan is rewrite the
dataReceived method in twisted.internet.protocol.Protocol and call the
sendLine method in ServerFactory.But i failed beacuse i can not get
the real ServerFactory object,when i set  in ServerFactory

       testFactory=StdioProxyFactory()
       host = "202.108.42.15"
       port = 8848
       reactor.connectTCP(host,port,testFactory)
       testFactory.protocol.server=self

but it a error say testFactory.protocol.server is None when i use it
How can i did like this ,or do it another way?Thanks




More information about the Twisted-Python mailing list