Reserving binary Buffer for struct.pack_into() of exact length

H

Hans Müller

Hello,

I need some buffers, which are beeing concatenated an then send via
the socket() function.
My problem is that create_string_buffer() creates a buffer which ist
one byte too long (for a \0 char). But when I concatenate some of
these buffers to a long one to be transfered, the extra byte is
corrupting the resulting buffer.
Of course I could slice the buffer before being concatended, but
this looks ugly to me.
Is there a way to create a writeable buffer object without the \0 byte ?

Thanks a lot

Hans
 
E

Emile van Sebille

On 3/19/2010 11:46 AM Hans Müller said...
Hello,

I need some buffers, which are beeing concatenated an then send via the
socket() function.
My problem is that create_string_buffer() creates a buffer which ist one
byte too long (for a \0 char). But when I concatenate some of these
buffers to a long one to be transfered, the extra byte is corrupting the
resulting buffer.
Of course I could slice the buffer before being concatended, but
this looks ugly to me.
Is there a way to create a writeable buffer object without the \0 byte ?

Thanks a lot

Hans
'hello'
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top