|
Boost Users : |
From: Tom Howard (tomhoward_at_[hidden])
Date: 2002-07-29 07:46:30
Hi,
I'm wondering if someone can help me with the pass through buffer
(basic_passthrubuf) that is part of more_io.
>From what I can understand the pass though buffer passes 1 character at a
time to (and from) the underlying stream buffer and I'm wondering what
happens with flushes.
In the code I'm working on (gzostreambuf which writes to an ostream) I need
to know is overflow() is being called because there is no more room in the
buffer I'm using or because of an explicit flush. In the later case I need
to also flush the compression (Z_SYNC_FLUSH), but doing so all the time will
degrade the compression performance plus increase the number of flushes to
the underlying stream.
This is particularly bad as the underlying stream in my case is a socket
stream an the increased flushes breaks up the data into many small packets.
Because of the software at the other end of the socket, data must be sent as
one message unless it's over 8096 bytes.
So basically I only want to flush the underlying stream if the gzostreambuf
has been flushed (either by endl or flush). is this possible?
My current workaround is to make sure the buffersize of my gzostreambuf is
greater than or equal to the buffersize of the underlying stream, but I was
hoping there was a neater solution and thats why I was looking at the pass
through buffer.
>From what I unbderstand, If I use the pass through buffer as part of my
gzostreambuf, then flushing will not be passed to the underling streambuf at
all. This means that data sent to the stream may be compressed, but result
in no output for quite some time later and this sort of latency would be
unacceptable in the software I'm working on (client-server multi-agent
simulation).
Cheers,
Tom Howard
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net