<div dir="ltr">Hi Glyph and David,<div><br></div><div>Thanks for your answers and thanks for taking time to answer. It was indeed my wrong understanding. I was trying to understand what HTTPClientChannelRequest does in terms of producer and consumer (Its a lot deep considering me being relatively new at this). Looking further at the code I do understand that we have a producer which generates the necessary data which can be written out using the transport and we have a consumer which works of the data from the dataReceived (I hope my understanding is correct and I don't know how it is buffered and I don't know how the flow tells the consumer that there is data for use).</div><div><br></div><div>I understand there is <a href="https://twistedmatrix.com/documents/15.4.0/core/howto/producers.html">https://twistedmatrix.com/documents/15.4.0/core/howto/producers.html</a>, however I was hoping if there is an example of a simple consumer which could be written using the data from dataReceived (that is assuming whatever I understood above is correct). I didn't find enough information on how to create a consumer.</div><div><br></div><div>Thanks,</div><div>-Roshan</div><div><br></div>







</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 7, 2015 at 11:37 PM, Glyph <span dir="ltr"><<a href="mailto:glyph@twistedmatrix.com" target="_blank">glyph@twistedmatrix.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><span class=""><blockquote type="cite"><div>On Sep 2, 2015, at 6:08 PM, Roshan Cherian <<a href="mailto:cherian.rosh@gmail.com" target="_blank">cherian.rosh@gmail.com</a>> wrote:</div><br><div><div dir="ltr">Hi Team,</div></div></blockquote><div><br></div></span><div>Hi Roshan!</div><div><br></div><div>Sorry it took a while to get back to you.  Busy week.</div><span class=""><br><blockquote type="cite"><div><div dir="ltr"><div>I am sorry if this is coming off as a newbie question. Its probably because I don't understand it enough.</div></div></div></blockquote><div><br></div></span><div>Newbie questions are fine, no need to apologize :).</div><span class=""><br><blockquote type="cite"><div><div dir="ltr"><div>I would like to:</div><div><br></div><div>1. connectTCP to a host, port</div></div></div></blockquote><div><br></div></span><div>You should not use connectTCP directly.  Use Endpoints: <<a href="https://twistedmatrix.com/documents/15.4.0/core/howto/endpoints.html" target="_blank">https://twistedmatrix.com/documents/15.4.0/core/howto/endpoints.html</a>>.  (But this doesn't affect the rest of your question.)</div><span class=""><br><blockquote type="cite"><div dir="ltr"><div>2. use the transport to write</div></div></blockquote><div><br></div></span><div>Should be easy enough; `self.transport.write´.</div><span class=""><br><blockquote type="cite"><div dir="ltr"><div>3. Use consumer to read from the transport what the tcp server has written to</div></div></blockquote><div><br></div></span><div>You don't need to use the producer / consumer API just to read from the transport.  The transport does this automatically, and calls your protocol's dataReceived method every time data is received from the transport.</div><span class=""><br><blockquote type="cite"><div dir="ltr"><div>I wasn't able to find information on consumer and how it gets triggered when data is available especially in the case I have</div></div></blockquote><br></span></div><div>I'm not sure what you mean about "how it gets triggered"; the producer and consumer APIs are documented here: <<a href="https://twistedmatrix.com/documents/15.4.0/core/howto/producers.html" target="_blank">https://twistedmatrix.com/documents/15.4.0/core/howto/producers.html</a>> but it would help if you could explain what <i>exactly</i> you're trying to achieve with them.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>-glyph</div><div><br></div></font></span></div><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" rel="noreferrer" target="_blank">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a><br>
<br></blockquote></div><br></div>