<div><span class="gmail_quote">On 7/11/05, <b class="gmail_sendername">Jp Calderone</b> &lt;<a href="mailto:exarkun@divmod.com">exarkun@divmod.com</a>&gt; wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">On Mon, 11 Jul 2005 12:16:35 -0500, Justin Johnson &lt;<a href="mailto:justinjohnson@gmail.com">justinjohnson@gmail.com
</a>&gt; wrote:<br>&gt;On 7/11/05, Jp Calderone &lt;<a href="mailto:exarkun@divmod.com">exarkun@divmod.com</a>&gt; wrote:<br>&gt;&gt;<br>&gt; [snip]<br>&gt;<br>&gt;&gt; 3. Notify the ProcessProtocol via protocol.makeConnection
 (not sure<br>&gt;&gt; &gt; why, looking at win32eventreactor)<br>&gt;&gt;<br>&gt;&gt; makeConnection is the method that's actually part of IProtocol (even<br>&gt;&gt; though ProcessProtocol doesn't implement IProtocol, it still adheres to its
<br>&gt;&gt; API in this regard). Generally, all it does is set the .transport attribute<br>&gt;&gt; on the protocol instance and then call connectionMade. This might seem<br>&gt;&gt; pointless in the case of processes, but since it maintains consistency with
<br>&gt;&gt; other kinds of transports, it is useful.<br>&gt;<br>&gt;&nbsp;&nbsp;So the Process class is the transport? In win32eventreactor, 3 threads are<br>&gt;started that loop on reading stdout and stderr and writing data from the
<br>&gt;outQueue to stdin. It seems to me that I would not use these threads, but<br>&gt;instead have each of these 3 file handles associated with the IOCP. Then the<br>&gt;methods defined in ops.py would be used to handle events on those handles,
<br>&gt;resulting in transport methods being called. These transport methods would<br>&gt;be methods on the Process class, which would result in methods on a single<br>&gt;instance of the ProcessProtocol being called. This single instance of the
<br>&gt;ProcessProtocol would be shared by all of the 3 file handles. Am I<br>&gt;understanding correctly? Are write and loseConnection the only methods the<br>&gt;Process would need to implement from ITransport?<br><br>That mostly sounds correct, except the last bit.&nbsp;&nbsp;What makes it a transport is that it implements /all/ of ITransport.&nbsp;&nbsp;Moreover, ProcessProtocols expect their transport to be an IProcessTransport, which adds several methods on top of ITransport.&nbsp;&nbsp;Everything in each of those interfaces needs to be implemented.
</blockquote>
<div>&nbsp;</div>
<div>Ahh... I missed those interfaces&nbsp;because I was starting with win32eventreactor.Process, which doesn't implement either ITransport or IProcessTransport (either with an implements() or by defining all of those methods).
</div>
<div>&nbsp;</div>
<div>After some more thought about this I think I will have to define new xxxOps methods for stdout and stderr (and maybe stdin as well).&nbsp; These ops' ovDone methods will call the methods on the transport (Process) appropriate for ProcessProtocols.
</div><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">For reference, &lt;<a href="http://twistedmatrix.com/documents/current/api/twisted.internet.interfaces.ITransport.html">
http://twistedmatrix.com/documents/current/api/twisted.internet.interfaces.ITransport.html</a>&gt; and &lt;<a href="http://twistedmatrix.com/documents/current/api/twisted.internet.interfaces.IProcessTransport.html">http://twistedmatrix.com/documents/current/api/twisted.internet.interfaces.IProcessTransport.html
</a>&gt;.<br><br>Jp<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">
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a><br></blockquote></div><br>