On Feb 22, 2010, at 9:13 AM, Christopher Armstrong wrote:

> On Mon, Feb 22, 2010 at 2:03 AM, gary clark <burslem2...@yahoo.com> wrote:
>> The correct way I think is to use base64 and just one connection after more 
>> research. Good to research.
>> 
>> Thanks,
>> Garyc
> 
> No, base64ing file contents is a terrible thing to do if you're
> already writing your own TCP-based protocol. Just length-prefix the
> data.

In Twisted, lots of classes exist to help you do this.  For simple length 
prefixing, have a look at any of the *stringReceiver classes in 
twisted.protocols.basic.  (NetstringReceiver, Int32StringReceiver, etc)

You can transmit binary data over many higher-level protocols as well; HTTP can 
handle binary entity-bodies just fine, as can twisted's "native" protocools, PB 
and AMP.



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

Reply via email to