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

Fabian Rothfuchs fabian.rothfuchs at googlemail.com
Thu Oct 6 19:04:50 EDT 2011



On 10/6/11 11:06 PM, "exarkun at twistedmatrix.com"
<exarkun at twistedmatrix.com> wrote:

>On 04:22 pm, fabian.rothfuchs at googlemail.com wrote:
>>Hey there,
>>
>>I'm currently implementing a Telnet Client, which is actually talking
>>to a
>>Console Server mapping Telnet to an RS232 interface.
>>
>>[snip]
>>
>>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.
>
>This is not so obvious.  Any hop along the route may fragment the data.
>>My question: is there any best practice for buffer techniques here?
>
>This question is too vague.  What problem are you trying to solve?
>
>Jean-Paul


JP,

What do you mean w/ 'any hop along the route' ?

My problem is, that I need something similar to telnetlib's `read_until()`
method (in my case read_until('USERID:')), although 'USERID:' may be sent
in independent events.
I wonder if this is up to me to implement, or if there's any Twisted-style
best practice.

Cheers
Fab


>
>_______________________________________________
>Twisted-Python mailing list
>Twisted-Python at twistedmatrix.com
>http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python





More information about the Twisted-Python mailing list