Twisted - howto transport megabytes?
Jp Calderone
exarkun at intarweb.us
Sun Jun 8 02:01:40 EDT 2003
On Sun, Jun 08, 2003 at 01:01:18AM -0400, Ed Young wrote:
> I am exploring Twisted for use as the basis for an
> application to application data transporter (queueing).
>
> When receiving large messages (multiple megabytes), I can
> use the dataReceived method to get the messages piecemeal.
> Since file writes can be blocking, how can I write the
> received pieces to a file in a non-blocking fashion?
>
> When sending large messages (multiple megabytes), well,
> I haven't figured that out yet. Does the transport
> method accept a filehandle from which it will feed as
> it needs to?
>
> The Twisted documentation is twisting my mind <sick_grin>.
> All hints appreciated...
You very likely want to make your protocol a producer, then register it
with a consumer (eg, your transport). An example of doing this can be found
in twisted.protocols.smtp -- SMTPClient is a producer, so as to gracefully
handle arbitrarily large emails.
Not that I want to discourage questions on c.l.py, but there is also a
mailing list dedicated to twisted - twisted-python at twistedmatrix.com - where
most developers are paying attention, and where more complex questions may
meet with a response.
Hope this helps,
Jp
More information about the Python-list
mailing list