[Twisted-Python] dataReveived() buffer best practice?
Fabian Rothfuchs
fabian.rothfuchs at googlemail.com
Thu Oct 6 10:22:18 MDT 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
following.
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 '^]'.
>MM
USERID:0004
PASSWORD:
#------
In my Twisted Client, I implemented dataReceived() to just do:
[]
def dataReceived(self, data):
..print 'received: %s'
..print
[]
and this is the result:
#------
drudge:Desktop rothfuchs$ p s12.py
received:
>
received: MM
USE
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?
Thanks
Fabian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20111006/dffde2cb/attachment.html>
More information about the Twisted-Python
mailing list