Thanks, Lucas.  I spent several hours struggling with this.  The source code DOES make it very obvious.  :-)  I hadn&#39;t realized from the buildProtocol API documentation that it assigned the factory attribute to the protocol instance.  It&#39;s so obvious now... :-)<br>
<br>And, now, I understand the &quot;magic&quot; of assigning the protocol to a factory which I did not before.<br><br>It runs fine!<br><br>Mark<br><br><div class="gmail_quote">On Fri, Feb 5, 2010 at 8:04 PM, Lucas Taylor <span dir="ltr">&lt;<a href="mailto:ltaylor.volks@gmail.com">ltaylor.volks@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="h5">On 2/5/10 5:23 PM, Mark Bailey wrote:<br>
<br>
</div></div>Hi Mark,<br>
<br>
The problem is that you have overridden buildProtocol in your Factory<br>
and not set the factory attribute on the protocol instance<br>
(ClusterClient instance has no attribute &#39;factory&#39;).<br>
<br>
buildProtocol is responsible for creating the protocol instance and the<br>
default implementation takes care of assigning the factory to the protocol.<br>
<br>
see the source for Factory and buildProtocol...it&#39;s very concise:<br>
<br>
<a href="http://twistedmatrix.com/trac/browser/tags/releases/twisted-9.0.0/twisted/internet/protocol.py#L87" target="_blank">http://twistedmatrix.com/trac/browser/tags/releases/twisted-9.0.0/twisted/internet/protocol.py#L87</a><br>

<a href="http://twistedmatrix.com/documents/9.0.0/api/twisted.internet.protocol.Factory.html#buildProtocol" target="_blank">http://twistedmatrix.com/documents/9.0.0/api/twisted.internet.protocol.Factory.html#buildProtocol</a><br>

<br>
<br>
So something like this should work in your case:<br>
<div class="im"><br>
    def buildProtocol(self, addr):<br>
        print &#39;Connected.&#39;<br>
        self.resetDelay()<br>
</div>        p = self.protocol()<br>
        p.factory = self<br>
        return p<br>
<br>
<br>
This doc is also helpful for understanding the relationship between<br>
Protocols and Factories:<br>
<a href="http://twistedmatrix.com/documents/current/core/howto/servers.html" target="_blank">http://twistedmatrix.com/documents/current/core/howto/servers.html</a><br>
<br>
It may be worth emphasizing that there&#39;s no real magic going on<br>
here...you&#39;re just assigning a python object as an attribute of the<br>
protocol instance.<br>
<br>
<br>
Lucas<br>
<br>
<br>
_______________________________________________<br>
Twisted-Python mailing list<br>
<a href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a><br>
<a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python" target="_blank">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a><br>
</blockquote></div><br>