<br><div class="gmail_quote">On Sun, Dec 5, 2010 at 4:07 PM, Umut Aydin <span dir="ltr">&lt;<a href="mailto:devnetwork@gmail.com">devnetwork@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hello everybody. Hope you have a good weekend.<br>
<br>
I&#39;m trying to port my distributed job server project to twisted but I<br>
have a few questions.<br>
<br>
I just tested twisted with protocol.Protocol socket handler class and<br>
it seems like that it creates a new instance for each connection. I<br>
want to put those connection&#39;s ip addresses into an array. Where<br>
should I do that exactly?<br>
<br>
How can I get ip address and port information out of self.transport.getPeer()?<br>
</blockquote></div><br>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. <br><br>Check out buildProtocol() method of twisted factories to customize protcol instantiation. <br>
<br>
Yes, transport.getPeers() gives you the remote end host and port.<br>
<br>
-- <br>
Thanks &amp; Regards,<br>
Godson Gera<br>
<a href="http://blog.godson.in">Twisted Python India</a><br><br>