[Twisted-Python] Porting Apache Mina to Twisted
devnetwork at gmail.com
Sun Dec 5 14:18:21 EST 2010
Thank you for your response.
I have another question. In my job server I collect worker connections
into a key/value structure by their categories which means jobs and I
send them some messages when a client connection made a request
suitable with one of worker connections. The problem is that worker
connection may not be available at the moment. I am looking for a
method (like isConnected in Apache Mina) to check if remote socket is
By the way may be I store wrong object. Maybe I should store something
else instead of storing self.transport Any advice will be appreciated!
Hope I could explain myself clearly.
On Sun, Dec 5, 2010 at 4:43 PM, Godson Gera <godson.g at gmail.com> wrote:
> On Sun, Dec 5, 2010 at 4:07 PM, Umut Aydin <devnetwork at gmail.com> wrote:
>> Hello everybody. Hope you have a good weekend.
>> I'm trying to port my distributed job server project to twisted but I
>> have a few questions.
>> I just tested twisted with protocol.Protocol socket handler class and
>> it seems like that it creates a new instance for each connection. I
>> want to put those connection's ip addresses into an array. Where
>> should I do that exactly?
>> How can I get ip address and port information out of
> Each created protocol comes with a refrence to factory that is creating
> them, which is a right place of doing all the inter protocol operations .
> You can access it via factory attribute of protocol. So, in a typical
> twisted program you can refer to the factory by doing self.factory in the
> created protocol. You can define an array called peers in factory and access
> it like self.factory.peers.
> Check out buildProtocol() method of twisted factories to customize protcol
> Yes, transport.getPeers() gives you the remote end host and port.
> Thanks & Regards,
> Godson Gera
> Twisted Python India
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
Email: me at umut.mobi
More information about the Twisted-Python