[Twisted-Python] LineReceiver and setRawMode()

jarrod roberson jarrod at vertigrated.com
Thu Sep 7 11:01:12 MDT 2006


I got a simple line protocol I am trying to implement, blocks .

CMD <byte count>\r\n
<payload>

when CMD 5\r\n

is received, I setRawMode()
and then inside of rawDataReceived() handle the blob

the problem is when my client sends the data and the next CMD line
gets eaten by the rawDataReceived() call before I can set it back to
lineMode().

so for something like

CMD 5\r\n
abcde
CMD 10\r\n
abcdefghij

after I get CMD 5\r\n
setRawMode()

inside rawDataReceived(data)
data = abcdeCMD 10\r\n

is there something in twisted that will help with this?
or do I need to subclass LineReceiver and add a
setRawMode(bytesToRead) or something?




More information about the Twisted-Python mailing list