Haven't used stringbuf before, but it looks like that just sets the internal
buffer for the stringbuf. You are going through a few layers of buffering
here; you probably want to just directly use a ZeroCopyOutputStream
implementation that writes to the socket, like FileOutputStream, which
allows you to control the buffer size. Then just have GzipOutputStream wap
that instead of an OstreamOutputStream.

On Fri, May 20, 2011 at 3:29 AM, Shin <for.shin1...@gmail.com> wrote:

> I attempt to use compressed data for my socket programing.
> The problem is the fixed output buffer size.
>
> Message *request;
> char buf[512];
> stringbuf sbuf;
> sbuf.pubsetbuf((char*)buf, sizeof(buf));
> ostream os(&sbuf);
> OstreamOutputStream *oos = new OstreamOutputStream(&os);
> GzipOutputStream *gzout = new GzipOutputStream(oos);
> request->SerializeToZeroCopyStream(gzout);
>
> write(sd, buf, sizeof(buf));
>
> I wanna use a loop to send the data.
> But I don't know how to control the stream to output fixed-size data.
>
> Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to