[Twisted-Python] Twisted serialport dataReceived() provides fragmented data

Sivakumar Balasubramanian siva82kb at gmail.com
Thu Aug 29 10:15:15 MDT 2013

Phil Mayers <p.mayers <at> imperial.ac.uk> writes:

> On 29/08/13 16:38, Sivakumar Balasubramanian wrote:
> > Is there something that I doing wrong in my code?
> Yes. You are sub-classing Int16StringReceiver, but then breaking things 
> by overriding dataReceived. You should be implementing stringReceived, 
> and you'll get complete strings.
> dataReceived does not get "messages" - a higher layer needs to buffer 
> and reassemble them, which Int16StringReceiver does, and passes the 
> messages to stringReceived.

Dear Phil,
I replaced thye dataReceived function by stringReceived, and ran the code.
But when I do this, the program does not even enter the stringReceived function.

I also tried a modified version of the programs above with LineReceived
protcol, and here too I have the same problem of fragmented data from the
dataReceived function.



More information about the Twisted-Python mailing list