On 2007-02-08, Diez B. Roggisch <[EMAIL PROTECTED]> wrote:

>>>> struct module pack and unpack will only work for fixed size buffer :
>>>> pack('>1024sIL', buffer, count. offset) but the buffer size can vary
>>>> from one packet to the next  :-(
>>>
>>> Oh for Pete's sake...
>>>
>>> struct.pack('>%dsIL' % len(buffer), buffer, count, offset)
>>
>> 
>> that is great but how does one unpack on the other side?
>
> By peeking into the header, determining the number of bytes necessary?

Better yet, use a protocol that's not brain-dead: send the
buffer size _before_ you send the buffer.

> But why do you need this anyway - if you know that you will
> have python on both ends, use Pyro or xmlrpc.

-- 
Grant Edwards                   grante             Yow!  A dwarf is passing
                                  at               out somewhere in Detroit!
                               visi.com            
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to