[Twisted-Python] Twisted TCP Window Full due to time-consuming fuction

Peng Xiao -X (penxiao - Digital China at Cisco) penxiao at cisco.com
Wed Mar 7 03:37:03 EST 2012


Hi experts

 

I have a program written by twisted to receive data from the server.

But the speed is a little slow.

The problem happened in the code below

    def dataReceived(self, data):

        

        """

        Appends newly received data to the receive buffer, and

        then attempts to parse as many messages as possible.

        """

        

        # Buffer possibly incomplete data first

        self.receiveBuffer += data

                # Attempt to parse as many messages as possible

        while(self.parseBuffer()): 

            pass

the function of parseBuffer will return false if the self.receiveBuffer
has no message, and then the twisted will receive data from buffer
again.

Because the function of parseBuffer is a litter time consuming, so the
receive buffer is full sometimes.

 

 

Could there anybody help me out? Thanks a lot.

 

Best

Regards,

 

Xiao peng

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20120307/ab55b3c9/attachment.htm 


More information about the Twisted-Python mailing list