[Twisted-Python] Message sizing design question

David Pratt fairwinds at eastlink.ca
Mon Jun 5 10:05:38 EDT 2006

Hi. I am trying to decide where to put message sizing for a custom 
protocol. I have set up the connections to be as generic as possible so 
message handling in as much as possible is being done by the connection 
handler that is aware of the connection it is handling at the time. 
There are a few things I need to keep track of at the connection 
(protocol) level such as original handshake and message id's that I am 
tracking per connection, but for the most part, everything else can be 
handled pretty generically by the connection handler.

In any case, where to deal with message sizing? My thought was that the 
connection handler should deal with it since it should also be 
responsible for encode and decode of messages. So to process or prepare 
a message size seems like it fits in the connection handler also.

I realize Banana, for example does sizing in the protocol itself but it 
does not anticipate handing the message off to a handler for such 
things. Anyway, it would be great if someone could confirm my reasoning 
or has some comments on this. Many thanks,


More information about the Twisted-Python mailing list