[Twisted-Python] dataReveived() buffer best practice?

Fabian Rothfuchs fabian.rothfuchs at googlemail.com
Thu Oct 6 12:22:18 EDT 2011

Hey there,

I'm currently implementing a Telnet Client, which is actually talking to a
Console Server mapping Telnet to an RS232 interface.
Further I'm using Twisted's conch.telnet lib to build that client, and I got
a little situation here where I wonder if there's already a best practice.
I guess the best way to introduce the problem is to show an example in the

This is the output of a regular Terminal session when connecting to the
Telnet Server:
drudge:~ rothfuchs$ telnet localhost 8001
Trying ::1...
Connected to localhost.
Escape character is '^]'.


In my Twisted Client, I implemented dataReceived() to just do:
def dataReceived(self, data):
ŠŠ..print 'received: %s'

and this is the result:
drudge:Desktop rothfuchs$ p s12.py

received: MM

received: RID:

I also ran a tcpdump to confirm ­ The opposite server is obviously pushing
content to the socket in arbitrary frequencies, ending up in my
dataReceived() method to get called arbitrarily as well.

My question: is there any best practice for buffer techniques here?


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

More information about the Twisted-Python mailing list