[Twisted-Python] Sending jpeg data over TCP/IP

Christopher Armstrong radix at twistedmatrix.com
Mon Feb 22 09:13:16 EST 2010


On Mon, Feb 22, 2010 at 2:03 AM, gary clark <burslem2001 at 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.


>
> --- On Sun, 2/14/10, gary clark <burslem2001 at yahoo.com> wrote:
>
>> From: gary clark <burslem2001 at yahoo.com>
>> Subject: Re: [Twisted-Python] Sending jpeg data over TCP/IP
>> To: "Twisted general discussion" <twisted-python at twistedmatrix.com>
>> Date: Sunday, February 14, 2010, 12:18 PM
>>
>> hey Alexandra,
>>
>> The only reason why I suggested another server would be to
>> distribute the
>> load on the system. Essentially the files that are intended
>> to be sent over will consume alot of processing since .jpeg
>> etc are humongous.
>> Yes two connections would be required. Well you could use
>> the MD5 sum, I will not, essentially your after a unique
>> identifier that represents the file your sending. What I
>> intend to do is simply embed the filename and unique
>> identifier as a header. Hence I do not not need to recompute
>> the MD5 at the receiving end, which to be honest seems
>> overkill.
>>
>> Anyway good luck. KISS for software is the best approach.
>>
>> Thanks,
>> Garyc
>>
>>
>> --- On Sun, 2/14/10, Alexandre Quessy <alexandre at quessy.net>
>> wrote:
>>
>> > From: Alexandre Quessy <alexandre at quessy.net>
>> > Subject: Re: [Twisted-Python] Sending jpeg data over
>> TCP/IP
>> > To: "Twisted general discussion" <twisted-python at twistedmatrix.com>
>> > Date: Sunday, February 14, 2010, 11:10 AM
>> > Hello again everyone,
>> > Maybe using two senders/receivers would help. The
>> control
>> > protocol,
>> > which can use XML or JSON, or whatever, would identify
>> the
>> > files by
>> > their md5 sum? The file transfert protocol would
>> detect the
>> > header of
>> > each file to separate them.
>> >
>> > a
>> >
>> > gary clark wrote:
>> > > There are probably several way to accomplish this
>> I
>> > just needed to think about it a wee bit longer. One
>> way
>> > would be to prepend an identifier to the file,strip
>> the
>> > header from the raw data on reception and then save
>> the
>> > image. I dont think its complicated. I may need a
>> seperate
>> > server to handle the files though.
>> > >
>> > > Thanks,
>> > > Garyc
>> > >
>> > > --- On Sat, 2/13/10, Maarten ter Huurne <maarten at treewalker.org>
>> > wrote:
>> > >
>> > >> From: Maarten ter Huurne <maarten at treewalker.org>
>> > >> Subject: Re: [Twisted-Python] Sending jpeg
>> data
>> > over TCP/IP
>> > >> To: "Twisted general discussion" <twisted-python at twistedmatrix.com>
>> > >> Date: Saturday, February 13, 2010, 6:07 PM
>> > >> On Sunday 14 February 2010, Alexandre
>> > >> Quessy wrote:
>> > >>
>> > >>> This said, sending them using a
>> programmer's
>> > solution
>> > >> - not a sysadmin
>> > >>> solution - would be closer to my own
>> skills,
>> > so I am
>> > >> interested in
>> > >>> knowing if this could be suitable. I
>> think,
>> > though,
>> > >> that it would be
>> > >>> faster to use a transfert protocol that
>> would
>> > be
>> > >> implemented in C, not
>> > >>> Python. Am I wrong?
>> > >> I would suggest to implement it in Python
>> first
>> > and then
>> > >> benchmark it. Maybe
>> > >> the simplest implementation is already fast
>> > enough. Maybe
>> > >> the bottleneck is
>> > >> the network or the disk you're writing to; in
>> that
>> > case you
>> > >> would be better
>> > >> off upgrading your switches or buying an SSD
>> > instead of
>> > >> writing C code.
>> > >>
>> > >> Bye,
>> > >>         Maarten
>> > >>
>> > >>
>> _______________________________________________
>> > >> Twisted-Python mailing list
>> > >> Twisted-Python at twistedmatrix.com
>> > >> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>> > >>
>> > >
>> > >
>> > > _______________________________________________
>> > > Twisted-Python mailing list
>> > > Twisted-Python at twistedmatrix.com
>> > > http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>> > >
>> >
>> > _______________________________________________
>> > Twisted-Python mailing list
>> > Twisted-Python at twistedmatrix.com
>> > http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>> >
>>
>
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>



-- 
Christopher Armstrong
http://radix.twistedmatrix.com/
http://planet-if.com/



More information about the Twisted-Python mailing list