[Twisted-Python] I am confused on transport.write and transport.writeSomeData
exarkun at twistedmatrix.com
exarkun at twistedmatrix.com
Sat Oct 9 06:07:18 MDT 2010
On 09:16 am, koder.chen.1984 at gmail.com wrote:
>It seems that, when use "self.transport.write" in the protocol
>implementation,
>it will buffer the content for a long time before it actually send it
>out, especially
>when the size of content is big, is there a 'flush' like method that I
>can do the
>flush manually?
There's no more buffering than is necessary. If your data isn't sent
pretty quickly, then you're doing something wrong. For example, perhaps
you're calling transport.write from a non-reactor thread? Or in a
never-ending loop?
>And when use 'self.transport.writeSomeData', if the size of content to
>be sent is
>large, it will not be able to send anything. What is the strategy to
>use it?
Don't ever call transport.writeSomeData. It will do something
arbitrarily wrong.
Jean-Paul
More information about the Twisted-Python
mailing list